JQuery 时间转化g

xiaoxiao2021-02-28  27

// 时间戳转化成 yyyy-mm-dd hh:mm:ss 样式的时间 function dates(date){ var time = new Date(date * 1000);    //根据时间戳生成的时间对象       var year = time.getFullYear(); var month = time.getMonth() + 1; var date = time.getDate(); var hours = time.getHours(); var minutes = time.getMinutes(); var seconds = time.getSeconds(); if(month < 10){ month = "0" + month; } if(date < 10){ date = "0" + date; } if(hours < 10){ hours = "0" + hours; } if(minutes < 10){ minutes = "0" + minutes; } if(seconds < 10){ seconds = "0" + seconds; } return year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds; }
转载请注明原文地址: https://www.6miu.com/read-2630127.html

最新回复(0)