The international standard notation for dates is:
Key YYYY = the year between 0000 and 9999. MM = the month between 01 (January) and 12 (December) DD = the day of the month between 01 and 31.
Values must be padded with leading zeros, so, the second day of January in the year 2017 is written as 2017-01-02
All authors targeting an international audience; particularly on the internet. Ambiguous culture-specific date formats can easily be misinterpreted: formats like 2/4/12 and 4/2/12 are very easily confused.
Where the language/culture of the audience is known, then Days or Months written out as text characters are more readable, this page deals only with numeric date formats.
The standard date notation described above is compliant with ISO 8601. Apart from the recommended primary standard notation YYYY-MM-DD, ISO 8601 also specifies a number of alternative formats for use in applications with special requirements.
- Date between 0000 and 1582 are assumed to be in the Proleptic Gregorian calendar rather than the Julian calendar commonly in use at the time.
- Separators can sometimes be omitted if compactness is more important than human readability: YYYYMMDD (but not YYYYMM to avoid confusion with YYMMDD.) e.g. 20120131 often printed on a product to indicate the date of manufacture.
- Year + day e.g. 2012-062 or 2012062
- Week numbers, week + day e.g. 2015W014
A week starts with Monday (day 1) and ends with Sunday (day 7).
Week 01 of a year is defined as the first week in the year that contains Thursday.e.g. Dec-Jan 2015/6: M T W T F S S 28 29 30 31 1 2 3 = WEEK 53 4 5 6 7 8 9 10 = WEEK 1
The week number can be described by counting Thursdays: week 12 contains the 12th Thursday of the year.
The international standard notation for the time of day is:hh:mm:ss key hh = Number of complete hours since midnight (00-24) mm = Number of complete minutes since the start of the hour (00-59) ss = Number of complete seconds since the start of the minute (00-60).
If the hour value is 24, then the minute and second values must be zero.
The value 60 for ss might sometimes be needed during an inserted leap second. In practice most clocks resynchronize some time after a leap second has happened, to avoid any disruption that an out-of-range timestamp might otherwise cause.
The two notations 00:00 and 24:00 are available to distinguish between midnight at the start of the day and midnight at the end of the day. Where a single representation is required, 00:00 is the preferred notation. Digital clocks display 00:00 and not 24:00.
As with the date notation, the precision can be reduced and/or the separating colons can be omitted, this is often required when creating date stamped files and folders as many file systems do not support the colon character in filenames:
It is also possible to add fractions of a second after a decimal dot or comma:
If a date and a time are displayed on the same line, always write the date in front of the time. If a date and a time value are stored together in a single data field, then ISO 8601 suggests they be separated by a capital letter T, as in 20120131T143059.
Importantly the standard specifies the use of 24 hour clock system.
By default a date and time as written above is assumed to be in some local time zone. To indicate that a time is measured in Universal Time (UTC), append a capital letter Z:
The Z stands for the zero meridian, which goes through Greenwich in London. Universal Time UTC was called Greenwich Mean Time (GMT) before 1972.
For other time zones, the strings below can be added to indicate the offset.
+hh:mm, +hhmm, or +hh
-hh:mm, -hhmm, or -hh
Positive values are hh hours and mm minutes ahead of UTC. (East of meridian)
Negative values are behind UTC (time zones west of the zero meridian)
The following all indicate the same point in time in UTC, CET and EST:
When saving date information in a database it is a good idea to save at least two of: Local Time, UTC and Offset. This can simplify any future support for the ever changing world of time zones and daylight saving time changes.
In VBScript return the current date in ISO8601 format:
Function isoDate() ' This script uses the functions Day, Month, and Year because ' they do not rely on the user's regional settings. dtmNow = Date() dtmDay = Day(dtmNow) dtmMonth = Month(dtmNow) dtmYear = Year(dtmNow) isoDate = dtmYear & "-" & dtmMonth & "-" & dtmDay End Function
“He was always late on principle, his principle being that punctuality is the thief of time” ~ Oscar Wilde
bash date command
Windows date command & StampMe script
PowerShell Get-Date & StampMe script & date formats
Dr J R Stockton’s website is full of detailed and accurate advice about date calculations.
Wikipedia ISO 8601 & usage across countries.
www.iso.org - Source for all ISO standards.