Neat-Lang / neat

The Neat Language compiler. Early beta?
BSD 3-Clause "New" or "Revised" License
111 stars 9 forks source link

stdlib: Wrap C strptime function for parsing timestamps #61

Open rsaarelm opened 8 months ago

rsaarelm commented 8 months ago

Signature would be something like (ZonedTime | :else) strptime(string timestamp, string format)

Usage: "2024-03-15T12:15:01+0200".strptime("%Y-%m-%dT%H:%M:%S%z"). The timezone info carrying time type is needed too...

Also do strftime that goes the other way, internal time value to formatted string. string strftime(ZonedTime t, string format).

FeepingCreature commented 8 months ago

Like SysTime in D, std.time.Time should have a timezone field and support all the parser stuff.