需要系统日期和时间的代码 [英] need code for system date and time
本文介绍了需要系统日期和时间的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在c#中的3层architechure中有一个asp.net Web应用程序bulid.
我需要读取数据库中存储的proc中存储的客户端系统(无论使用的日期和时间).
hi everyone,
I have a asp.net web application bulid in 3 layer architechure in c#.
I need to read the client system(whoever using ) date and time stored in the stored proc in database.
please help me in coding.
推荐答案
所有发生的事件都发生在与服务器的交互中.并且服务器知道其本地时间,应该使用 System.DateTime.UtcNow ^ ]
在客户端,您可以使用JavaScript方法Date.getTimezoneOffset将UTC时间转换为本地时间. /www.w3schools.com/jsref/jsref_gettimezoneoffset.asp [ ^ ]
All events which happen happen in interaction with the server; and the server knows its local time, which should be got using System.DateTime.UtcNow http://msdn.microsoft.com/en-us/library/system.datetime.utcnow.aspx[^]
On client side, you can use JavaScript method Date.getTimezoneOffset to translate UTC time into local time.. See this turorial : http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp[^]
请参阅此相似的线程
如何获取客户端PC在asp.net C#中的日期时间? [
Refer this similar thread
How to get the date time of client PC in asp.net C#?[^]
这篇关于需要系统日期和时间的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文