Microservice - Timestamps and Dates Formatter


Example Usage:

Example Output:

{ "x": "1670112000000", "f": "12/4/2022, 12:00 AM", "ff": "Dec 4, 2022, 12:00 AM", "fff": "December 4, 2022 at 12:00 AM UTC", "ffff": "Sunday, December 4, 2022 at 12:00 AM Coordinated Universal Time", "F": "12/4/2022, 12:00:00 AM", "FF": "Dec 4, 2022, 12:00:00 AM", "FFF": "December 4, 2022 at 12:00:00 AM UTC", "FFFF": "Sunday, December 4, 2022 at 12:00:00 AM Coordinated Universal Time", "D": "12/4/2022", "DD": "Dec 4, 2022", "DDD": "December 4, 2022", "DDDD": "Sunday, December 4, 2022", "WW": "48", "o": "338", "ooo": "338", "q": "4", "qq": "04", "cccc": "Sunday", "L": "12", "LL": "12", "LLL": "Dec", "LLLL": "December", "Z": "+0", "ZZ": "+00:00", "ZZZ": "+0000", "ZZZZ": "UTC", "ZZZZZ": "Coordinated Universal Time", "a": "AM", "d": "4", "dd": "04", "date": "2022-12-04T00:00:00.000Z", "dt": "2022-12-04", "unix": 1670112000000, "utc": "Sun, 04 Dec 2022 00:00:00 GMT", "iso": "2022-12-04T00:00:00.000Z", "json": "2022-12-04T00:00:00.000Z", "localeDate": "12/4/2022", "localeTime": "12:00:00 AM", "toTime": "00:00:00 GMT+0000 (Coordinated Universal Time)", "toString": "Sun Dec 04 2022 00:00:00 GMT+0000 (Coordinated Universal Time)", "utcDay": 4, "year": 2022, "month": "12", "dmy": "4-12-2022", "ymd": "2022-04-12", "toDateString": "Sun Dec 04 2022" }

Specifying format in query:

Example Output:

{ "DDDD": "domingo, 4 de diciembre de 2022" }

Table of tokens for format query:

(Examples below given for 2014-08-06T13:07:04.054 considered as a local time in America/New_York).

Standalone token Format token Description Example
Z narrow offset +5
ZZ short offset +05:00
ZZZ techie offset +0500
ZZZZ abbreviated named offset EST
ZZZZZ unabbreviated named offset Eastern Standard Time
z IANA zone America/New_York
a meridiem AM
d day of the month, no padding 6
dd day of the month, padded to 2 06
c E day of the week, as number from 1-7 (Monday is 1, Sunday is 7) 3
ccc EEE day of the week, as an abbreviate localized string Wed
cccc EEEE day of the week, as an unabbreviated localized string Wednesday
ccccc EEEEE day of the week, as a single localized letter W
L M month as an unpadded number 8
LL MM month as a padded number 08
LLL MMM month as an abbreviated localized string Aug
LLLL MMMM month as an unabbreviated localized string August
LLLLL MMMMM month as a single localized letter A
y year, unpadded 2014
yy two-digit year 14
yyyy four- to six- digit year, pads to 4 2014
W ISO week number, unpadded 32
WW ISO week number, padded to 2 32
o ordinal (day of year), unpadded 218
ooo ordinal (day of year), padded to 3 218
q quarter, no padding 3
qq quarter, padded to 2 03
D localized numeric date 9/4/2017
DD localized date with abbreviated month Aug 6, 2014
DDD localized date with full month August 6, 2014
DDDD localized date with full month and weekday Wednesday, August 6, 2014
t localized time 9:07 AM
tt localized time with seconds 1:07:04 PM
ttt localized time with seconds and abbreviated offset 1:07:04 PM EDT
tttt localized time with seconds and full offset 1:07:04 PM Eastern Daylight Time
T localized 24-hour time 13:07
TT localized 24-hour time with seconds 13:07:04
TTT localized 24-hour time with seconds and abbreviated offset 13:07:04 EDT
TTTT localized 24-hour time with seconds and full offset 13:07:04 Eastern Daylight Time
f short localized date and time 8/6/2014, 1:07 PM
ff less short localized date and time Aug 6, 2014, 1:07 PM
fff verbose localized date and time August 6, 2014, 1:07 PM EDT
ffff extra verbose localized date and time Wednesday, August 6, 2014, 1:07 PM Eastern Daylight Time
F short localized date and time with seconds 8/6/2014, 1:07:04 PM
FF less short localized date and time with seconds Aug 6, 2014, 1:07:04 PM
FFF verbose localized date and time with seconds August 6, 2014, 1:07:04 PM EDT
FFFF extra verbose localized date and time with seconds Wednesday, August 6, 2014, 1:07:04 PM Eastern Daylight Time
X unix timestamp in seconds 1407287224
x unix timestamp in milliseconds 1407287224054