12345678910111213141516171819202122232425262728 |
- function formatDate(time) {
- var t = getDate(time);
- var tf = function (i) {
- return (i < 10 ? '0' : '') + i
- };
- var year = t.getFullYear();
- var month = tf(t.getMonth() + 1);
- var day = tf(t.getDate());
- var hour = tf(t.getHours());
- var minute = tf(t.getMinutes());
- return month + '-' + day + ' ' + hour + ':' + minute;
- }
- function getBirthday(birthday) {
- var t = getDate(birthday);
- var tf = function (i) {
- return (i < 10 ? '0' : '') + i
- };
- var year = t.getFullYear();
- var month = tf(t.getMonth() + 1);
- var day = tf(t.getDate());
- return year + '年' + month + '月' + day + '日';
- }
- module.exports = {
- formatDate: formatDate,
- getBirthday: getBirthday
- }
|