Click here to Skip to main content
11,707,254 members (53,371 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET SQL jQuery
I am creating a web chat application using vb. I have got the chat system to work as messages are sent and relayed back to the clients. But there was something i noticed but never thought it would be a problem. I am from England and the chat application is sitting on servers in America and noticed when the message displayed the time, the times were situated in American time zones. How would i go about setting the timezones that will correspond to there country timezones.
So if the message display 17:00 American time, then the message sent to England should display 12:00 English time.
All messages are stored in SQL Server Database. And in Table it take the server time.But sertime is India 
Posted 27-Jan-13 17:13pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could start by using getutcdate() (or the C# equivalent DateTime.UtcNow) in your table rather than getdate()
Then you need a timezone table which stores offset (0:english time ), -6:New York, etc...) from UTC
User should have a timezoneId property they can select depending where they are
Then when displaying you calculate the UTCtime of your message + the offset and you're done

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 145
1 OriginalGriff 141
2 chainerlt 110
3 Mika Wendelius 80
4 Maciej Los 80
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,806
4 Mika Wendelius 3,706

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100