date_format

A simple API to format dates.

Usage

Use formatDate function to format a DateTime

print(formatDate(new DateTime(1989, 02, 21), [yyyy, '-', mm, '-', dd]));

Output:

1989-02-21

Long month names

print(formatDate(new DateTime(1989, 2, 21), [yy, '-', M, '-', d]));

Output:

89-feb-21

Time parts

print(formatDate(
      new DateTime(1989, 02, 1, 15, 40, 10), [HH, ':', nn, ':', ss]));

Output:

15:40:10

Timezone

print(formatDate(
      new DateTime(1989, 02, 1, 15, 40, 10), [HH, ':', nn, ':', ss, z]));

Output:

15:40:10+0100

Libraries

date_format
Support for doing something awesome. [...]