如何获得当前日期&用户发布内容的时间 [英] How To get Current Date & Time of user posting something

查看:120
本文介绍了如何获得当前日期&用户发布内容的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

datetime.now()返回当前日期&系统的时间,但我必须获得当前的日期和时间正在使用它的用户系统的时间,

例如,当用户发布当前日期&在数据库中保存的时间是服务器而不是用户系统,

任何人都可以帮忙,我如何从服务器机器获取用户系统的日期和时间

我的代码



datetime.now() return the current date & time of the system but i have to get the current date & time of the user system who is using it ,
E.g when a user post something the current date & time save in database are of the server not the user system ,
Can anyone help , how do i get date and time of the user system not from server machine
my Code

Dim d As String
           d = DateTime.Now.ToString("hh:mm dddd, dd/MM/yyyy")

推荐答案

你可以追踪IP和根据IP的当地时间,您可以根据用户获得帖子的日期。



是代理可能会误导,但我没有更好的主意



或者您可以在javascript中获取当前日期并使用ajax。
You can trace the IP and according to IP's local time you can get the date of the post according to user.

Yes Proxy can be misleading but I have no better idea

Or you can get current date in javascript and get with ajax.


http://www.dotnetperls.com/datetime-format-vbnet [ ^ ]



http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx? cs-save-lang = 1& cs-lang = vb#code-snippet-1 [ ^ ]


这篇关于如何获得当前日期&用户发布内容的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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