$(function () { //scrollable sidebar $(".scrollable-sidebar").mCustomScrollbar({ theme: "minimal-dark" }); }); /**** 获取当前时间*/ function getNow(s) { return s < 10 ? '0' + s: s; } var myDate = new Date(); //年 var year=myDate.getFullYear(); //月 var month=myDate.getMonth()+1; //日 var date=myDate.getDate(); var h=myDate.getHours(); //获取当前小时数(0-23) var m=myDate.getMinutes(); //获取当前分钟数(0-59) var s=myDate.getSeconds(); var now=year+'-'+getNow(month)+"-"+getNow(date)+" "+getNow(h)+':'+getNow(m)+":"+getNow(s); // console.log(now); $(".years").text(year); $(".day").text(date); $(".month").text(month); $(".month-en").text(month); $(function () { var month = ["Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."]; $(".month-en").each(function () { for (var i = 0; i <= month.length;i++) { if ($(this).text() == i.toString()) { $(this).text(month[i-1]); $(this).text($(this).text()); } } }); }); $(function () { var month = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]; $(".month").each(function () { for (var i = 0; i <= month.length;i++) { if ($(this).text() == i.toString()) { $(this).text(month[i-1]); $(this).text($(this).text()+'月'); } } }); });