« ReFreezed.com
LuaWebGen

Datetime

This page describes the date and time format used in LuaWebGen.

The calendrical calculations always assume a Gregorian calendar, with no leap seconds.

Datetime strings must have numbers/words representing date and optionally time. Use commas and spaces as delimiters. The stated day of the week is ignored whether it's correct or not. A string containing an invalid date is an error (e.g. a string containing two years or two months is an error).


Time Format

Hours, minutes, and seconds are separated by colons, although all need not be specified. "10:", "10:11", and "10:11:12" are all valid. If the 24-hour clock is used, it is an error to specify "PM" for times later than 12 noon. For example, "23:15 PM" is an error.

Time Zone Format

First character is a sign "+" (east of UTC) or "-" (west of UTC). Hour and minute offsets are separated by a colon.

Jul 27 2006 03:56:28 +2:00

Another format is [sign][number] without colon. If [number] is less than 24, it is the offset in hours e.g. "-10" = -10 hours. Otherwise it is the offset in hundred hours, e.g. "+75" = "+115" = +1¼ hours.

Jul 27 2006 -75   (2006-07-27 01:15 UTC)
Jul 27 2006 -115  (2006-07-27 01:15 UTC)
Jul 27 2006 +10   (2006-07-26 14:00 UTC)
Jul 27 2006 +2    (2006-07-26 22:00 UTC)

Standard timezones GMT, UTC, EST, EDT, CST, CDT, MST, MDT, PST and PDT are supported.

Jul 27 2006 GMT  (2006-07-27 00:00 UTC)
Jul 27 2006 UTC  (2006-07-27 00:00 UTC)
Jul 27 2006 EST  (2006-07-27 05:00 UTC)
Jul 27 2006 EDT  (2006-07-27 04:00 UTC)
Jul 27 2006 CST  (2006-07-27 06:00 UTC)
Jul 27 2006 CDT  (2006-07-27 05:00 UTC)
Jul 27 2006 MST  (2006-07-27 07:00 UTC)
Jul 27 2006 MDT  (2006-07-27 06:00 UTC)
Jul 27 2006 PST  (2006-07-27 08:00 UTC)
Jul 27 2006 PDT  (2006-07-27 07:00 UTC)

Date Format

Short dates can use either a "/" or "-" date separator, but must follow the month/day/year format.

02-03-70  (1970-02-03 UTC)
12/25/98  (1998-12-25 UTC)

Long dates of the form "July 10 2005" can be given with the year, month, and day in any order, and the year in 2-digit or 4-digit form. If you use the 2-digit form, the year must be greater than or equal to 70.

Feb-03-70         (1970-02-03 UTC)
December 25 2008  (2008-12-25 UTC)

Supported ISO 8601 Formats

YYYY-MM-DD

where YYYY is the year, MM is the month of the year, and DD is the day of the month.

2000-12-31
20001231

YYYY-DDD

where YYYY is the year, DDD is the day of the year.

1995-035  (1995-02-04 UTC)
1995035   (1995-02-04 UTC)

YYYY-WDD-D

where YYYY is the year, DD is the week of the year, D is the day of the week.

1997-W01-1  (1996-12-30 UTC)
1997W017    (1997-01-05 UTC)

DATE HH:MM:SS

Where DATE is the date format described above, HH is the hour, MM is the minute, SS is the seconds.

1995-02-04 24:00:51  (1995-02-05 00:00:51 UTC)
1976-W01-1 12:12:12  (1975-12-29 12:12:12 UTC)
1995-035 23:59:59    (1995-02-04 23:59:59 UTC)

Compact version separated by Latin capital letter T:
19950205T000051      (1995-02-05 00:00:51 UTC)
1976W011T121212      (1975-12-29 12:12:12 UTC)
1995035T235959       (1995-02-04 23:59:59 UTC)

DATE TIME +HH:MM, DATE TIME -HHMM, DATE TIME Z

Where DATE and TIME are the date and time formats described above. First character is a sign "+" (east of UTC) or "-" (west of UTC). HH and MM is hour and minute offset. The Z stands for zero offset.

1976-W01-1 12:00Z       (1975-12-29 12:00 UTC)
1976-W01-1 13:00+01:00  (1975-12-29 12:00 UTC)
1976-W01-1 0700-0500    (1975-12-29 12:00 UTC)

Page updated: 2021-07-07