silverlight 中的日期和时间 +里亚尔服务

发布于 2024-08-30 22:49:40 字数 412 浏览 1 评论 0原文

我在 sliverlight 4 + RIA 服务中面临一个非常奇怪的问题,或者也许这并不奇怪,我只是一个新手,无论如何我希望这里有人可以提供帮助,问题如下 我在域服务内的服务器端创建了一个函数,这个函数非常简单,其中有一行将服务器当前日期和时间添加到数据库中 (这是一个 HR 应用程序,员工应该从自己的电脑上通过它登录和退出)

Emp.TimeOut = system.DateTime.now (C# 语法)

奇怪的部分是,对于某些用户来说,它总是在当前时间上添加 3 小时(如果他在 5 点退出,则显示 8),对于其他人来说,它工作得很好。

服务器和公司里的所有站点都有完全相同的时间设置和相同的时区,而且无论如何我的功能都在服务器端,所以它应该与用户时间无关。

有什么想法为什么会发生这种情况吗?几天来我一直试图找出原因,但没有成功。

I'm facing a very weird problem in sliverlight 4 + RIA Services, or maybe it's not weird and I'm just a newbie anyway I hope someone here can help, the problem is the following
i've created a function on the server side inside the domain service this function is very simple and has a line in it that adds the server current date and time to the database
(it's an HR application and employees should sign in and out thrue it each from it's own pc )

Emp.TimeOut = system.DateTime.now (C# syntax)

the weird part is that for some users it always adds 3 hours to the current time(exp if he signs out at 5 it shows 8) and for others it works perfectly.

The server and all the stations in the company have exactly the same time settings and the same time zone, and anyway my function is on the server side so it should no be related to the users time.

Any ideas why this is happening? I've been trying to find out why for days now but with no luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风透绣罗衣 2024-09-06 22:49:40

您需要使用 UTC 值...通常在涉及序列化的地方...无论是数据库还是客户端。在适合显示/人工读取时转换为本地时间(在输入情况下则转换为本地时间)

You need to use UTC values ... generally everwhere there is serialization involved ... whether to DB or to client. Convert to local time when appropriate for display/human readin (and from in the case of input)

夏有森光若流苏 2024-09-06 22:49:40

谢谢Nikhil,你是对的,问题似乎出在日期时间不同类型上,我有时会得到本地类型,有时会得到未指定的类型,所以我只是将所有内容转换为字符串而不是日期时间,它工作得很好,我会做更多下次学习我想使用日期时间,这样我就知道如何更好地处理它。非常感谢您的帮助

Thank you Nikhil you are right the problem seemed to be from the datetime diffrent kinds i'm getting sometimes local kind and other times unspesified kind, so i just converted all to String instead of Datetime and it's working just fine, i'll do more studies for the next time i want to use datetime so i know how to handle it better. Thank you very much for your help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文