JS 日期与时间戮相互转化的简单实例
1、日期格式转时间戮
functiongetTimestamp(time)
{
returnDate.parse(newDate(time));
}
2、时间戮转日期格式
functiontransformPHPTime(time)
{
vardate=newDate(time*1000);
Y=date.getFullYear()+'-';
M=(date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1)+'-';
D=date.getDate()+'';
h=date.getHours()+':';
m=date.getMinutes()+':';
s=date.getSeconds();
returnY+M+D+h+m+s;
}
以上就是小编为大家带来的JS日期与时间戮相互转化的简单实例全部内容了,希望大家多多支持毛票票~
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短