/**
* 得到当前日期
*/
function getNowFormatDate() {
var date = new Date();
// var seperator1 = "-";
var month = date.getMonth() + 1;
var strDate = date.getDate();
var hours = date.getHours(); // 获取当前小时数(0-23)
var minutes = date.getMinutes(); // 获取当前分钟数(0-59)
var seconds = date.getSeconds(); // 获取当前秒数(0-59)
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
//var currentdate = {
// year: date.getFullYear(),
// mouth: month,
// day: strDate,
// hours:hours,
// minute:minutes,
// second:seconds
//};
var currentdate = date.getFullYear() + "-" + month + "-" + strDate + " " + hours + ":" + minutes + ":" + seconds;
return currentdate;
}
获取当前时间 Jquery
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- @interface UIScreen (addtion) /**获取屏幕宽度*/ (CGFloat)pq_scr...
- 在开发中,有时会遇到需要获取元素html内容,再进一步遍历或操作,而jquery中的jquery.html()是获...