求助关于时间JS出现NaN错误var today=new Date();var hours = today.getHours();var minutes = today.getMinutes();var seconds = today.getSeconds();var timeValue = " " + ((hours >12) "下午 "+hours -12 :"上午 "+hours); timeValue += ((minutes <
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/28 04:03:34
求助关于时间JS出现NaN错误var today=new Date();var hours = today.getHours();var minutes = today.getMinutes();var seconds = today.getSeconds();var timeValue = " " + ((hours >12) "下午 "+hours -12 :"上午 "+hours); timeValue += ((minutes <
求助关于时间JS出现NaN错误
var today=new Date();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
var timeValue = " " + ((hours >12) "下午 "+hours -12 :"上午 "+hours); timeValue += ((minutes < 10) ":0" :":") + minutes+" ";
调用时分钟没问题,但是小时出现NaN,请问需要怎么修改?
求助关于时间JS出现NaN错误var today=new Date();var hours = today.getHours();var minutes = today.getMinutes();var seconds = today.getSeconds();var timeValue = " " + ((hours >12) "下午 "+hours -12 :"上午 "+hours); timeValue += ((minutes <
// hours - 12 用括号括起来
var timeValue = " " + ((hours >12) ? "下午 "+ (hours -12) : "上午 "+hours);