dz-format-time
v1.0.2
Published
``` import {formatDate,getTimeDetail} from '';
Downloads
2
Readme
import {formatDate,getTimeDetail} from '';
/**
formatDate(time,{
format:'YY-MM-DD || YY-MM-DD hh:mm:ss || YY-MM || YY || MM || DD(date) || hh:mm:ss || hh || mm || ss || dd(day)'
timestamp:false || true,
})
*/
// get today
formatDate();
// get today
formatDate(0);
// format timestamp to date
formatDate(9999999999999);
2286-11-21
// format timestamp to datetime
formatDate(9999999999999,{
fomat:'YY-MM-DD hh:mm:ss'
});
2286-11-21 01:46:39
// format date to timestamp
formatDate('2021-11-28',{
timestamp:true
});
1638028800000
// get today`s timestamp
formatDate(0,{
timestamp:true
});
// get time detail obj
getTimeDetail('2021-11-28 15:16:32');
{
YY: 2021,
MM: 11,
DD: 28,
dd: 0, (sunday)
hh: 15,
mm: 16,
ss: 32
}