Take the 2-minute tour ×

We have a system that schedules appointments and is based in the UK. Project Managers use it to schedule appointments for UK staff as well as Australian staff.

PMs will put an appointment in the schedule for say 9am on Monday but that is independent of location; i.e. when a UK staff member sees it he/she reads it as 9am UK time and when an Australian staff member reads it they read it as 9am Aus time.

I have written an Outlook plugin that displays these bookings and allows selection of them. The problem is that when the plugin runs in Australia it sees the datetime originates from the UK and adds the time difference. So as a result the Australian staff have their appointments offset when they shouldn't be.

I'm using an Infragistics Schedule control and wondered what the best way is to ensure that a 9am appointment appears as 9am in all locations and the offset is NOT applied?

Thanks, Drammy

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

For me, the best way is to always use UTC datetime everywhere in your code. Only when show you can switch (or not) to the good timezone.


The Locale / UTC is defined using the DateTimeKind enum ( http://msdn.microsoft.com/en-us/library/shx7s921.aspx )

Always use DateTime.ToUniversalTime() in order to get the DateTime in UTC ( http://msdn.microsoft.com/en-us/library/system.datetime.touniversaltime.aspx )

(Of course the ToLocalTime() exists too).

You should do some tests in order to check everything is looking as expected.

share|improve this answer
Thanks - so the query from the db would be the same but when handling the dates in C# I would use the UTC datetime? –  Drammy Aug 13 '12 at 14:10
Not always a good idea for appointments. For example, if a meeting is always "3pm UK time" you need to record that - because what that means in terms of the UTC time will change over the course of the year. It also means that something scheduled a long way in the future will still have the right local time (which is what the user almost always cares about) even if the time zone rules change. –  Jon Skeet Aug 13 '12 at 14:10
So what do you recommend Jon? I need to ensure that PMs can book an appointment to start at 9am irrespective of where the appointment is. I also need to ensure that the appointment appears as 9am no matter where it is viewed. –  Drammy Aug 13 '12 at 14:21
You're right, but even gmail didn't do that way... So IMHO it's easier to handle properly UTC and show using the good timezone. It's the work of the UI Control to display with the good local time. –  ykatchou Aug 13 '12 at 15:47
Moreover, in the case of international datetime, the UTC is the only one reliable ! Exactly because the local time are built-on it. –  ykatchou Aug 13 '12 at 15:48
show 2 more comments

Your Answer


