1、日期格式转时间戮
function getTimestamp(time) { return Date.parse(new Date(time)); }
2、时间戮转日期格式
function transformPHPTime(time) { var date = new Date(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(); return Y+M+D+h+m+s; }
以上就是小编为大家带来的JS 日期与时间戮相互转化的简单实例全部内容了,希望大家多多支持脚本之家~
最后
以上就是开心店员最近收集整理的关于JS 日期与时间戮相互转化的简单实例的全部内容,更多相关JS内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复