本地日期时间与服务器日期时间 [英] local date time versus server date time

查看:291
本文介绍了本地日期时间与服务器日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用使用日历中的click事件填充日期时间戳.
问题是我在新西兰,服务器在美国/加拿大.

虽然在开发过程中它可以在localhost中正常运行,但上传到服务器后
双击今天"给我昨天的日期.

我联系了服务器服务台(认为他们可能会帮助哈哈),他们全都给了我看您的开发人员"的答案,或者现在我们已经有了您的钱打败了ch子"(舌头上的舌头)

(对于那些不知道以上内容的人应该是在开玩笑哈哈:-))


无论如何,有没有一种方法可以使日历获取客户端的时间戳记?
之前有人必须反对过吗?

预先感谢您的任何建议

保罗

PS似乎没有解决这个问题的灵丹妙药:-)我正确吗?

My app uses click event from calender to populate a datetime stamp.
The problem is I''m in new zealand and the server is in USA/Canada.

While it runs fine in localhost during development, after upload to server
a double click on "Today" gives me yesterdays date.

I contacted the server help desk (thought they might help ha ha) and they gave me the catch all "see your developer" answer, or "we have got ur money now beat it bitch" (tongue in cheek)

(For those who don''t know the above line is supposed to be a joke ha ha :-))


Anyway, is there a way to make the calender pick up client side time date stamp?
someone must have come up against this one before?

Thanks in advance for any suggestions

Paul

PS seems there is no silver bullet for this one only workarounds :-) am I right???

推荐答案

您可以要求用户说出他在哪个时区将其驻留并保存在服务器上,然后在存储时将所有时间从本地时间转换为UTC时间,否则将其反向转换.

我不知道ASP.NET日历控件.我在我的应用程序中使用jQuery日历.同样在我的情况下,如果用户不想使用UTC时间,则必须选择一次其时区.一旦选择了时区,则在渲染页面时所有时间都将转换为该时区,而在保存页面时将所有时间转换为UTC.顺便说一句,我正在使用ASP.NET MVC.

检查ASP.NET日历是否以某种方式允许您指定要使用的时区.使用Google,我发现:

http://msdn.microsoft.com/en-us/library/8k0f6h1h (v = VS.85).aspx [
You can ask the user to tell in which time zone he reside and save that on the server and then convert all time from local time to UTC time when storing them and convert them in the reverse direction otherwise.

I don''t know for the ASP.NET calendar control. I use a jQuery calendar in my application. Also in my case, the user has to select its time zone once if he does not want to use UTC time. Once a time zone has been selected, all times are converted to that zone when I render the page and converted by to UTC when I save the page. By the way, I am using ASP.NET MVC.

Check if the ASP.NET calendar somehow allow you to specify the timezone to use. Using Google, I have found that:

http://msdn.microsoft.com/en-us/library/8k0f6h1h(v=VS.85).aspx[^]

By the way, it is generally easy to find answers on the web for most problem you might encounter using Google.


您可以看一下并看看如果有帮助的话,
http://stackoverflow.com/questions/319367/how-to-转换服务器时间到本地时间 [ ^ ]
You could have a look at this and see if that helps you;
http://stackoverflow.com/questions/319367/how-to-convert-server-time-to-local-time[^]


这篇关于本地日期时间与服务器日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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