Skip to content

DateString

Returns a string representation of a date. Without arguments, returns the current date/time.

$ wo 'StringLength[DateString[]] > 0'
True
$ wo 'DateString[{2026, 4, 15}, "ISODate"]'
2026-04-15
$ wo 'DateString[{2026, 4, 15}, "Year"]'
2026

Common format specifications

  • "ISODate"2026-04-15
  • "ISODateTime"2026-04-15T12:34:56
  • "DateTime"Wed 15 Apr 2026 12:34:56
  • "Date"Wed 15 Apr 2026
  • "Time"12:34:56
  • "Year", "Month", "Day" → individual components