format

format(d: date, pattern: text) 🡒 text, const pure function

The format function provides a small formatting framework intended to convert a date its text counterpart. The first argument is the date to be formatted. The second argument is the pattern, a sequence of specifiers used to specify the intended formatting.

d = date(2022, 9, 26)

show summary "Formats" a1a3 with
  format(d, "yyyy-MM-dd")  // 2022-09-26
  format(d, "M/dd/yy")     // 9/29/22
  format(d, "MMM d, yyyy") // Sept 26, 2022

The list of supported specifiers is given in the Date & time format page. The time format information will be rejected.

User Contributed Notes
0 notes + add a note