📜  以格式获取日期 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:03.555000             🧑  作者: Mango

代码示例2
// GET THE CURRENT TIME............
const date = new Date();
var year = date.getUTCFullYear();
var month = (date.getUTCMonth()).toString.length == 2 ? date.getUTCMonth(): '0'+ date.getUTCMonth() ;
var day = (date.getUTCDay()).toString.length == 2 ? date.getUTCDay(): '0'+ date.getUTCDay() ;
var hours = date.getUTCHours();
var minutes = date.getUTCMinutes();
exDate = 'beckup_'+ year + '-' + month + '-' + day + '-' + hours + '-' + minutes ;