![]() Different end users talking to the same server may have different TZOs that tell WebScheduleInfo what TimeSpan to use when translating to / from UTC so that the server always sees UTC and the end user always sees their local time. WebScheduleInfo has a property on it that lets you set the TimeZoneOffset to use for this end user. I thought the problem might be resolved by a property setting on a grid column – now, I think I might be forced to attain the time offset using JavaScript, save the offset to a hidden field, and generate the date/time in SQL using the DATEADD SQL function? Kinda a pain, eh… The end result is that I want to present a WebGrid interface of Appointments generated using the Infragistics Scheduler. Regardless, how does the Infragistics Scheduler save local time to UTC time, and display UTC time to local time? Is it a bit of a trade secret? ![]() How do these functions work with dispersed server farms? Weird, very weird. However, are they modifying the entered dates using the server(s) offset - or the clients? My best guess is the server. ![]() I found the ToUniversal and ToLocal methods in the C# DateTime and the Infragistic SmartDate classes. These time issues have now proven a bit difficult to deal with. The WebSchedule data model stores everything in UTC because if it were stored as local time, two users viewing an appointment from different time zones would believe the appointment started at different times.ĭerek, Thanks for your quick reply… The Web Application I am writing will be used world wide, mostly within the US - but, also wherever the Marine Corps is. Note that if you want to allow the end user to edit the StartDateTime column, then you will need to perform the reverse translation from local time into UTC time (subtract the TimeSpan for the offset, so it would be +5 hours for EST) in an event like UpdateCell before the changes get commited to the Activities table in your database. You would have to loop over the Rows collection(s), pluck out the Cell from that Row's Cells collection for the Column you wish to display local date/times in, perhaps parse the formatted string text value into a DateTime, add this TimeSpan to the DateTime, then assign the DateTime as a formatted string text value back into the Cell. I think I can handle the offset for generating the SQL to filter the data used in the browse, but how can I display the local date version of the UTC date in a grid column?ĭo you know what the end user's local time zone is? If you know their time zone is US Eastern Standard Time for example (whether from an authenticated user's preferences, or just because it's an intranet application for an organization with a single office located squarely in the eastern US and no access by anybody in another timezone is possible) then you could create a TimeSpan for -5 hours (which is the offset from the Greenwich Meridian running through London - GMT or Greenwich Mean Time and UTC will be identical when there is no Daylight Savings Time in effect as there is currently, but the offset should be adjusted by +1 for DST if and when it affects your geography) and add that to the DateTime displayed in each cell. Regardless, the webscheduler saves the start dates as a UTC date.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |