This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


gives a string representing the complete current local date and time.
gives the specified element or format for date and time.
DateString[{"elem1", "elem2", ...}]
concatenates the specified elements in the order given.
DateString[{y, m, d, h, m, s}]
gives a string corresponding to a DateList specification.
gives a string corresponding to an AbsoluteTime specification.
DateString[spec, elems]
gives elements elems of the date or time specification spec.
  • The following output elements can be given:
"Date"full date
"DateShort"full date, with short day and month names
"Time"full time
"DateTime"full date and time
"DateTimeShort"full date and time, with short names
"Year"full year (e.g. 2005)
"YearShort"2-digit year (e.g. 05)
"QuarterName"quarter of year (e.g. "Quarter 1")
"QuarterNameShort"quarter of year in short form (e.g. "Q1")
"Quarter"quarter number (e.g. 1)
"MonthName"month name (e.g. "August")
"MonthNameShort"month name in short form (e.g. "Aug")
"MonthNameInitial"first letter of month name (e.g. "A")
"Month"2-digit month number (e.g. 08)
"MonthShort"1- or 2-digit month number (e.g. 8)
"DayName"day of the week (e.g. "Wednesday")
"DayNameShort"day of the week in short form (e.g. "Wed")
"DayNameInitial"first letter of day name (e.g. "W")
"Day"2-digit day of the month (e.g. 09)
"DayShort"1- or 2-digit day of the month (e.g. 9 or 29)
"Hour"2-digit hour based on system preferences
"Hour12"2-digit hour on 12-hour clock (e.g. 07)
"Hour24"2-digit hour on 24-hour clock (e.g. 19)
"HourShort"1- or 2-digit hour based on system preferences
"Hour12Short"1- or 2-digit hour on 12-hour clock (e.g. 7)
"Hour24Short"1- or 2-digit hour on 24-hour clock (e.g. 7, 19)
"AMPMLowerCase"am or pm
"Minute"2-digit minute (e.g. 05)
"MinuteShort"1- or 2-digit minute (e.g. 5 or 35)
"Second"2-digit seconds
"SecondShort"1- or 2-digit seconds
"SecondExact"seconds including fractions
"Millisecond"3-digit milliseconds
"MillisecondShort"1-, 2- or 3-digit milliseconds
  • Any other string given in the list of elements is concatenated literally in the output string.
  • Shorter lists can be used in DateString[{y, m, ...}]: {y} is equivalent to {y, 1, 1, 0, 0, 0}, {y, m} to {y, m, 1, 0, 0, 0}, etc.
  • Values of m, d, h, m, s outside their normal ranges are appropriately reduced. Non-integer values of d, h, m, s can also be used. »
  • In DateString[spec, elems]the following date and time specifications can be given as spec:
timeabsolute time specification
{y,m,d,h,m,s}DateList specification
"string"DateString output
{"string",{"e1","e2",...}}date string formed from specific elements
  • In the form DateString[{"string", {"e1", "e2", ...}, ...] the "ei" can be "Year", "YearShort", "Quarter", "Month", "MonthName", "Day", "DayName", "Hour", "Hour12", "AMPM", "Minute", or "Second".
  • DateString[{"string", {"e1", "e2", ...}, ...] uses the "ei" to fill in elements of {y, m, d, h, m, s}. Those not filled in are taken to have default values {yc, 1, 1, 0, 0, 0}, where yc is the current year. »
  • In DateString[{"string", {"e1", "e2", ...}, ...], the "ei" are extracted from "string" in the order given, and can be separated by any non-alphanumeric characters. »
  • DateString[{"string", {"e1", "sep12", "e2", "sep23", ...}, ...] extracts elements using the explicit separators specified. »
  • In DateString[spec, elems] the time and date corresponding to spec are by default assumed to be in the time zone specified by $TimeZone, unless spec explicitly specifies another time zone.
  • DateString[] uses whatever date and time have been set on your computer system. It performs no corrections for time zones, daylight saving time, etc.
  • DateString[TimeZone -> z] gives the date and time inferred for time zone z by assuming that your computer is set for the time zone specified by $TimeZone. »
Find the current date:
The current date in a specific format:
Another date in a specific format:
Find the current date:
Click for copyable input
The current date in a specific format:
Click for copyable input
Another date in a specific format:
Click for copyable input
Find the day of the week corresponding to a date:
Date lists are converted to standard normalized form:
Strings are automatically interpreted when possible:
Separators for input strings are assumed if not specified:
Give explicit separators for an input date string:
Day, hour, minute and second values can be non-integers:
The current year is used if not specified in a string:
Convert an absolute time to a date string:
Find the current date in Greenwich, United Kingdom:
Make a dynamically updating clock:
AbsoluteTime represents dates as seconds since the beginning of 1900:
DateList represents dates as lists of date elements:
DateString represents dates as strings:
Use $DateStringFormat to define the output formatting:
DateString gives results that match a DatePattern:
Use DateListPlot to plot data with date string x coordinates:
Use DatePlus to add time units to a date string:
Use DateDifference to find the number of time units between dates:
Use Order and DateList to determine the order of dates:
Explicit elements may be needed to interpret ambiguous strings:
New in 6