- function getDatetime(){
- var dt = new Date();
- return (dt.getFullYear()+'-'+(dt.getMonth()+1)+'-'+dt.getDate()+' '+dt.getHours()+':'+dt.getMinutes()+':'+dt.getSeconds()).replace(/([\\-\\: ])(\\d{1})(?!\\d)/g,'$10$2');
- }
- //该片段来自于http://www.codesnippet.cn/detail/181020136494.html
来源: http://www.codesnippet.cn/detail/181020136494.html