如何处理过去的日期时间问题 [英] how to handle with past datetime problem

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

问题描述

我在IIS服务器上托管了我的网站。如果我使用我的本地机器上的域名访问我的网站,如果我去当前日期更改为上一个日期,那么在jquery日期选择器中启用这些日期。如果我将日期更改为过去的日期,我想禁用这些日期。启用的所有日期将根据主机日期。帮我解决这个问题

i have hosted my website on IIS server. if i am accessing my website with my domain name from my local machine if i go and change the current date to the previous date then in jquery date picker those dates are enabled. i want to disable those dates if i change the date to past dates. all the dates enabled will be according to hosting machine dates. help me out with this

推荐答案

如果你想使用服务器的日期和时间值,那么你需要在服务器而不是客户端上运行代码。但是......鉴于世界是圆的,并且可以从世界上任何地方访问网站,最好让用户使用他自己的本地客户端日期和时间,并在将服务器转换为UTC后在服务器中验证。



假设客户日期错误是非常本地的思考 - 在全球范围内可能非常错误。特别是因为你不一定知道服务器将在哪个时区,(我的在美国,当地时间晚8个小时!) - 因此转换为UTC!
If you want to use server date and time values, then you need to run code on the server, instead of the client. But...given that the world is round, and websites can be accessed from anywhere in the world, it's better to let the user use his own local client date and time and validate that in the server once you have converted it to UTC.

Assuming that the client date is "wrong" is very "local" thinking - and probably very wrong in a global context. Especially as you don't necessarily know what time zone the server is going to be located in, (mine is in the US and 8 hours behind my local time!) - hence the conversion to UTC!


这篇关于如何处理过去的日期时间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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