Timestamps Server vs Client

For future victims of Skulpt’s missing strptime:

def datetimefromisoformat(s, tzinfo=None):
    return datetime(int(s[0:4]), int(s[5:7]), int(s[8:10]), int(s[11:13]), int(s[14:16]), int(s[17:19]), int(s[20:]), tzinfo=tzinfo)

Same deal as @p.colbert’s version: this does basically no syntax checking, but it may suffice for modern dates.

if you’re using the tzinfo arg, be sure to read this post from @daviesian first: Time Zone issues

1 Like