截取字符串: var str = "1234567890"; var a = str.substring(0,8); //==str.substring(8)---结果:12345678 var str = "1234567890"; var a = str.substring(0,8); //==str.substring(8)---结果:12345678 显示当前期系统时间: var today = new Date(); var day = toda…
function showCurrentDate(){ var today,hour,second,minute,year,month,date; var strDate ; today=new Date(); var n_day = today.getDay(); switch (n_day) { case 0:{ strDate = "星期日" }break; case 1:{ strDate = "星期一" }break; case 2:{ strDate =…
最近在游戏里要显示当前系统时间的功能,网上一搜很多写着获取的方法,大都是如下 struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); struct tm *tm; tm = localtime(&now.tv_sec); int year = tm->tm_year + 1900; int month = tm->tm_mon + 1; int day = tm->tm_mday; int hour=…