Skip to content

Repository files navigation

tinydateformat2

Date formatting tool in less than 1kb

Install

npm install tinydateformat2 --save

Browsers

<scriptsrc="https://cdn.jsdelivr.net/npm/tinydateformat2/dist/tinydateformat.js"></script>

Usage

CommonJS

consttinydateformat2=require('tinydateformat2')

ES Modules

importtinydateformat2from'tinydateformat2'
// default: 'HH:mm:ss' and Date.now()tinydateformat2()// => 14:26:04tinydateformat2('DD/MM/YYYY')// => 25/03/2023tinydateformat2('YY/M/DD','2023-1-10')// => 23/1/10tinydateformat2('YY/MM/DD','2023-1-10')// => 23/01/10
FormatOutputDescription
YY23Two-digit year
YYYY2023Four-digit year
M1-12The month, beginning at 1
MM01-12The month, 2-digits
MMMJan-DecThe abbreviated month name
MMMMJanuary-DecemberThe full month name
D1-31The day of the month
DD01-31The day of the month, 2-digits
d1-7The day of the week
H0-23The hour
HH00-23The hour, 2-digits
h1-12The hour, 12-hour clock
hh01-12The hour, 12-hour clock, 2-digits
m0-59The minute
mm00-59The minute, 2-digits
s0-59The second
ss00-59The second, 2-digits

About

Date formatting tool in less than 1kb

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages