gpt4 book ai didi

javascript - 在javascript中添加时间(以秒为单位)

转载 作者:行者123 更新时间:2023-11-28 18:54:20 24 4
gpt4 key购买 nike

我有这个功能

        var countt = count, time = count.data('countdown'), format = count.data('format');
var Otime = new Date(time), o = {
serverSync: serverTime,
until:Otime,
// demo data set to reset timer, when it's finished
// change zeroCallback to prefered callback
zeroCallback: function(options) {
}
};
if(format){
$.extend(o,{format:format});
}else{
$.extend(o,{layout: '{dn} {dl} {hnn}{sep}{mnn}{sep}{snn}'});
}
count.countdown(o)
}

我想为此添加 10 秒 var Otime = new Date(time)我正在寻找类似的东西

var Otime = new Date(time) + 10 seconds

有合适的方法吗?

编辑:

function change_date(count)
{
var serverTime = function() {
var time = null;
$.ajax({
url: 'index.php',
async: false,
dataType: 'text',
data:{
page:'__request',
module:'PSF_auctions',
action:'get_server_time'
},
success: function(text) {
time = new Date(text);
},
error: function(http, message, exc) {
time = new Date();
}
});
return time;
}

返回时间变量,即当前系统时间

最佳答案

var Otime = new Date(time)
Otime.setSeconds(Otime.getSeconds() + 10);

关于javascript - 在javascript中添加时间(以秒为单位),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33942568/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com