How to format a time string

Output example:

"defFormat": "d-m-Y", output day-month-year.
TEMPLATE STRING-sets a template for displaying a time string, like the date() function in PHP:

s — seconds from 00 to 59 (two digits)
i — minutes from 00 to 59 (two digits)
h — hours in 12-hour format from 01 to 12 (two digits)
H — hours in 24-hour format from 00 to 23 (two digits)
d — day of the month from 01 to 31 (two digits)
w — day of the week from 0 to 6 (one sign: 0-Sunday, 6-Saturday)
D — day of the week name from Mon to Sun (three characters: Mon Tue Wed Thu Fri Sat Sun)
m — month from 01 to 12 (two digits)
M — month name from Jan to Dec (three digits: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
Y — year from 2000 to 2099 (four digits)
y — year from 00 to 99 (two digits)
a — noon am or pm (two characters, lowercase)
A — noon AM or PM (two characters, uppercase)

Leave a Comment

Supported the project — saved a DIY maker! And we accept gifts...

X