Time measurements and units of measure. See also my sections on JavaScript Date object, Microsoft Time Functions, My About#Dates.

Units

Thankfully most modern systems agree upon the second as the unit of time.

Here is the traditional set.

Here is a metric set. Note that "metric min", "metric h", "metric d", and "metric y" are hardly ever used.

See also Intro to History.

Translate Time

Given a date, the form below returns the date in various formats. So far my code only works for Microsoft Internet Explorer. [2004-08-17: I updated my code to work according to the W3C DOM so it works on browsers like MSIE and Mozilla.]

Date-Time to translate

Enter a date-time in a format accepted by JavaScript. EGs:

  • Mon, 25 Dec 1995 13:30:00 GMT. The TZDs (Time Zone Designators) accepted are : UT|GMT|UTC|Z, EST|EDT|R, CST|CDT|S, MST|MDT|T, PST|PDT|U,  other military single letter TZDs, ±HHMM, ±HH, ±H. [2004-10-01: Apparently Mozilla's JS does not accept the military single letter TZDs.]
  • Dec 25, 1995. Defaults to 00:00:00 local time.
  • 12/25/1995 2:00 PM. Note that 2 digit years are assumed to be in the 1900s. Variations such as P.M., pm, and p.m. are also accepted.

Local Time Z Time
. .
. .
. .
. .

Time Formatting

You may also want to see my section on Microsoft Time Functions.

IS0 8601

ISO 8601 [1988], in my opinion, is more elegant than RFC 822. Here are the basics of ISO 8601.

DATESCalendar date. CC               EG: 19 (19th century) CCYY             EG: 1997
CCYY-MM          EG: 1997-07
CCYY-MM-DD       EG: 1997-07-16
Ordinal week of year & ordinal day of week.
CCYY-WWW         EG: 1997-W29 (29th week of 1997). W01 is always 1st week with a Thu.
CCYY-WWW-D       EG: 1997-W29-3 (3rd day of the 29th week). 1st day is always Mon.
Ordinal day of year.
CCYY-DDD         EG: 1997-198 (198th day of 1997). Watch for leap years.
TIMES
hh               EG: 19 (19th hour or 7 p.m. local time)
hh.h             EG: 19.35 hh:mm            EG: 19:21
hh:mm.m          EG: 19:21.5
hh:mm:ss         EG: 19:21:30
hh:mm:ss.s     EG: 19:21:30.4537
hh:mm:ss.sTZD    EG: 19:21:30.4537+01:00 or 18:21:30.4537Z Any of the time options may have a TZD.

A date and a time may be concatenated with a t. EG: 1997-07-16t18:21:30.4537Z.

The standard has is case-insensitive for all the literal letters used. That is T, P, R, W, Y, M, D, H, and S can be substituted with t, p, r, w, y, m, d, h, and s. I prefer to use  upper case M for month and lower case m for minutes. I also prefer the lower case t to the upper case T because it is easier to see visually and because a lower case t has a tradition of usage as the variable for time.

It is allowable to remove the separating hyphens and colons. EG: 19970716t192130.4537+0100 is "Basic Format" according to the standard, while 1997-07-16t19:21:30.4537+01:00 is considered "Extended Format". The Basic Format is not as human readable but it is useful programmatically and in situations where you want to save space and/or avoid those characters, especially in the case of file or directory names.

Dates and times may be truncated with an implied date portion that's signified with a single dash (-). Sufficient context is of course required. It is safer and easier to avoid implied date portions, esp. if the date may be taken out of context.

BCE (or B.C.) years can be indicated with a negative sign. EG: -1500-07 is July 1500 BCE. Years of greater magnitude can also use more than 4 digits. EG: -600000 is 600,000 BCE.

The following examples indicate the same point in time (ignoring daylight savings time).

12:00Z = 13:00+01:00 = 13:00 CET (Central European Time)
12:00Z = 07:00-05:00 = 07:00 EST (Eastern Standard Time)
1995-02-04t24:00 = 1995-02-05T00:00

Periods of time or time intervals are done 4 different ways:

Recurring periods of time or recurring time intervals are expressed like the 4 ways of expressing non-repeating periods of time except that they start with R/ (to repeat forever) or Rn/ (to indicate how many times the interval repeats). EGs: These examples repeat 3 times.

R3/1998-05-12/15
R3/P1Y2M3D  (R/P1Y would recur annually forever)
R3/1998-05-12t14:15Z/P0001-02-03
R3/P1Y2M3D/1998-05-12t14:15Z

ISO 8601 is vastly superior for many reasons. Here are a few:

  • It is human and machine readable.
  • Increase machine readability by removing the special characters like "-" and ":".
  • Sort ISO 8601 formatted dates without any modification.
  • Databases often accept ISO 8601. EG: Microsoft SQL Server 2005 takes this format: yyyy-mm-ddThh:mm:ss[.mmm], regardless of the SET DATEFORMAT or SET LANGUAGE settings.

RFC 822

RFC 822 [1982] is the original standard for ARPA Internet text message (including email). RFC 822 was updated with RFC 1123 [1989] for 4 digit years. Here are the basics of RFC 822 copied right out of the RFC.

date-time   =  [ day "," ] date time          ; dd mm yy
                                              ; hh:mm:ss zzz

day         =  "Mon"  / "Tue" /  "Wed"  / "Thu" /  "Fri"  / "Sat" /  "Sun"

date        =  1*2DIGIT month 2*4DIGIT        ; day month year
                                              ; EG: 20 Jun 82

month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
            /  "May"  /  "Jun" /  "Jul"  /  "Aug"
            /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"

time        =  hour zone                         ; ANSI and Military

hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]    ; 00:00:00 - 23:59:59

zone        =  "UT"  / "GMT"                ; Universal Time
                                            ; North American : UT
            /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
            /  "CST" / "CDT"                ;  Central:  - 6/ - 5
            /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
            /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
            /  1ALPHA                      ; Military: Z = UT;
                                            ;  A:-1; (J not used)
                                            ;  M:-12; N:+1; Y:+12
            / ( ("+" / "-") 4DIGIT )        ; Local differential
                                            ;  hours+min. (HHMM)

EGs:

Mon, 25 Dec 1995 13:30:00 GMT
Mon
5 Dec 95
13:30:00 Z

While RFC 822 is a nice little standard, it is not used much outside of the Internet. In contrast ISO 8601 is broadly used and is comparable to the formatting already used by the Chinese and astronomers.

Miscellany

Links

Links that lead to off-site pages about time, units of time, and so on.

Page Modified: (Hand noted: ) (Auto noted: )