获取服务器端时间和客户端时间之间的差异并显示它 [英] Get the difference between a server side time and client side time and display it
问题描述
可能重复:
如何将javascript倒计时与服务器时间同步
如何计算服务器端时间和客户端时间之间的差异,然后在我的视图中显示它,这是一个PHP页面。
How can I get the to calculate the difference between the server side time and the client side time and then display it in my view , which is a PHP page .
让我说清楚一点。我有一个特定板球比赛的时间数据,它存储在数据库中。现在,我想在我的视图中显示客户端浏览器中这个时间和时间之间的差异,这是一个PHP页面。我可以理解我需要为此编写一个javascript函数,但是如何从我的PHP代码中调用此函数,并且我必须在我的视图中显示差异。
Let me make this a bit clear. I have a time data for a particular cricket match to start which is stored in the database . Now, I want to display the difference between this time and the time in the client browser in my view which is a PHP page. I can understand that I need to write a javascript function for this , but how can I call this function from my PHP code ,and again I have to display the difference in my view.
我对此感到困惑。
推荐答案
date.js 非常方便日期计算,可以解析/显示各种格式的日期。
date.js is pretty handy for date calculations and can parse/display dates in various formats.
这篇关于获取服务器端时间和客户端时间之间的差异并显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!