根据用户国家/地区显示日期时间 [英] Show Datetime according to user Country
问题描述
我有当地时间(根据巴基斯坦标准时间)的数据
喜欢
---------
i have data in local time (according to Pakistan standard time )
Like
---------
sno name Date_Time
1 abc 10-Jan-2012 4:29
2 abc 10-Jan-2012 6:29
我必须根据用户标准时间显示"Date_Time"数据
假设是否有任何用户登录印度
它应根据其标准显示"Date_Time"
作为"2012年1月10日4:29"数据库中的数据存储
但是巴基斯坦和
之间有半小时的差别
印度
所以应该显示
印度用户"2010年1月10日4:59"而不是"2010年1月10日4:29"
为巴基斯坦用户登录名,因此应显示此
其他用户的"2010年1月10日4:29",以此类推
在用户浏览器上
i have to show data of "Date_Time" according to user standard time
suppose if any user login to India
it should show " Date_Time " according to their standard
as Data Store In Database on " 10-Jan-2012 4:29 "
but there are half hour difference between Pakistan and
India
so it should be showed
" 10-Jan-2010 4:59 " for Indian User Instead of this " 10-Jan-2010 4:29"
as Pakistani User Login so it should show this
" 10-Jan-2010 4:29 " and so on for others user
On User Browser
推荐答案
请参阅此CP文章
http://www.codeproject.com/KB/aspnet/Remote_Time_Zone.aspx
See this CP article
http://www.codeproject.com/KB/aspnet/Remote_Time_Zone.aspx
从客户端获取并显示日期.您可以在页面加载时在Java脚本中使用以下代码.
Hi,
Get and display the date from the client side.You can use the below code in java script on the page load.
function updateClock ()
{
var currentTime = new Date ();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var currentHours = currentTime.getHours ();
var currentMinutes = currentTime.getMinutes ();
var currentSeconds = currentTime.getSeconds ();
}
希望这会有所帮助.
Hope this helps.
这篇关于根据用户国家/地区显示日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!