var _todayDate = new Date(); var t_year = this._todayDate.getFullYear(); var t_month = this._todayDate.getMonth()+1; var t_date = this._todayDate.getDate(); var t_hour = this._todayDate.getHours(); var t_minute = this._todayDate.getMinutes(); var t_sec = this._todayDate.getSeconds();然后把年月日时分秒,用字符串连接起来变成2006-11-27 16:15的格式
发的时候太出现了,前面的代码多了this,下面的是对的 var _todayDate = new Date(); var t_year = _todayDate.getFullYear(); var t_month = _todayDate.getMonth()+1; var t_date = _todayDate.getDate(); var t_hour = _todayDate.getHours(); var t_minute = _todayDate.getMinutes(); var t_sec = _todayDate.getSeconds();
var t_year = this._todayDate.getFullYear();
var t_month = this._todayDate.getMonth()+1;
var t_date = this._todayDate.getDate();
var t_hour = this._todayDate.getHours();
var t_minute = this._todayDate.getMinutes();
var t_sec = this._todayDate.getSeconds();然后把年月日时分秒,用字符串连接起来变成2006-11-27 16:15的格式
var _todayDate = new Date();
var t_year = _todayDate.getFullYear();
var t_month = _todayDate.getMonth()+1;
var t_date = _todayDate.getDate();
var t_hour = _todayDate.getHours();
var t_minute = _todayDate.getMinutes();
var t_sec = _todayDate.getSeconds();