更新时间:2023-02-26 16:16:07
你需要将值拆分:
,在通过模运算符运行第一个值后重建它。试试这个:
You need to split the value by :
, the rebuild it after running the first value through the modulo operator. Try this:
var offTime = "17:25:11".split(':');
offTime[0] = offTime[0] % 12;
var output = offTime.join(':');
alert(output);