定时器、时区、服务器端时间、客户端倒计时 [英] Timer, timezone, server side time, client side countdown

查看:35
本文介绍了定时器、时区、服务器端时间、客户端倒计时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近启动了一个项目(此处),但我被计时器/时间卡住了问题:

I've launch a project recently (here), and I'm stuck with a timer/time question :

我有一个每天运行两次的定时任务:法国时区的午夜和中午.

I have a cronjob who runs everyday, twice a day : midnight and midday in french timezone.

我想显示倒计时到下一页",这实际上是到 cronjob 的倒计时.

I want to display a "countdown till next page", which is in fact a countdown till cronjob.

我有点卡住了,因为当我开始思考与时间和时区相关的事情时,我的大脑就冻结了.

I'm a bit stuck, because when I start to think time and timezone related things, my brain just freeze.

我知道我应该占用服务器端时间,并在客户端计时器中显示我的变量(不获取客户端时间),但仅此而已.

I know I should take server side time, and display my variables in a client side timer (without getting the client side time), but that's pretty much it.

我真的很感激一些建议!

I'd really appreciate some advises !

先谢谢大家!

推荐答案

你应该使用 Keith Wood 的倒数计时器:http://keith-wood.name/countdown.html

You should use Keith Wood's countdown timer: http://keith-wood.name/countdown.html

它非常易于使用.

你所要做的就是

$('#timer').countdown({
    until: '<?php echo date("h:i:s"); ?>' // change this, obviously
});

这是小提琴:http://jsfiddle.net/tqyj4/289/

这篇关于定时器、时区、服务器端时间、客户端倒计时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆