date and time

Langur 0.9 introduces date-time literals, the syntax of which uses a subset of ISO 8601, extended format only. Here are some examples.

An empty date-time literal generates the current date-time in your time zone. A date-time literal with only a time zone offset or Z (UTC) specified generates the current date-time in that time zone.

If not specifying a time zone only, the year, month, day, and hour are required. Minutes, seconds, and time zone offset are optional.

The date and time are separated by either a space or a capital T.

Dates are proleptic Gregorian.

The operators ==, <=, etc. can be used to compare date-times.

time zone

The default time zone used is your local time zone.

The letter Z gives the UTC time zone (same as +00:00).


Some built-in functions help with dealing with date-times.

The toHash() function will give you all the data about a date-time value in separate hash fields.

When passing a date-time to the toNumber() function, it will return the number of nanoseconds since the start of January 1, 1970 UTC.

The toString() function, without a second argument, will produce an ISO 8601/RFC 3339 timestamp. A second argument would be a format string to use. This formatting is currently the same as that used by the Go time package.


A formatting string may be passed to the toString() function or used in a date-time interpolation modifier.

The Go time package expects the following numbers and formats in a format string.

date-time dev

There is more development to do on this....