Click here to Skip to main content
15,886,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
my website is in us server now my problem is how to get uk current time .
Posted

You need to get the UTC time and then convert it to the desired time zone. Take a look at the .NET globalization features. This link should get you started:
MSDN: Converting Times Between Time Zones[^]
 
Share this answer
 
Comments
Thomas Daniels 6-May-15 10:55am    
UK time is not always UTC; right now it's DST there, so it's UTC+1.
virusstorm 6-May-15 11:00am    
Correct, but if you get UTC time, you can convert it UK time very easily using the libraries.
Thomas Daniels 6-May-15 11:02am    
You don't even need the UTC time, you can convert the local time to UK time directly. Please see Solution 2.
You can use TimeZoneInfo.ConvertTimeBySystemTimeZoneId:
C#
DateTime ukTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "GMT Standard Time");
 
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