Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

i have req. like if i open my website in diff. countries then it should show that country date time.

ex.
if i open my website in USA then it should show USA date time, if open in Australia then it should show Australia date time and so on.

Note: many countries have more than one time zone.

thanks in advance.
Posted
Updated 4-Jun-13 2:24am
v2
Comments
Prasad Khandekar 4-Jun-13 6:17am    
How are you going to determine the country/location from where the site was opened? HTML5 now includes support for Location API but this may not be usable from all devices including the desktop/laptop pcs.
kk2014 4-Jun-13 7:07am    
hi prasad,
i don't know how to determine the country/location but i want user date and time from where he/she will open the website.
thanks.

C#
var remoteTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
var remoteTime = TimeZoneInfo.ConvertTime(DateTime.Now, remoteTimeZone);
Console.WriteLine("Time in {0} is {1}", remoteTimeZone.Id, remoteTime.TimeOfDay.ToString());
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900