views:

275

answers:

2

I have an application on a server which is UK based.

Say I needed the application to run at the same time for different countries. For arguments sake say I needed it to send an email to a mailbox whenever the time is 7pm in various countries.

How would I be able to achieve this? At the moment I just have it running from the Task Scheduler at the specific time (which is fine for UK based clients). However, I would like to support internationally.

Thanks.

+2  A: 

Store date/times as UTC, and then compute time for each locations's time zone.

Plesae see: C# - Convert UTC/GMT time to local time

Mitch Wheat
It's the second part that's the hard bit. Noda Time is not quite ready yet but soon it will be a good solution for time zone calculations in .NET: http://code.google.com/p/noda-time/
DrJokepu
Ok so when storing the DateTime (when using the system DateTime) I should always use UTC. However, from my example where I am just using Task Scheduler and running the application at 7pm, how would I work out when it is 7pm in different countries for it to trigger?
James
This is pretty much what I had to do.
James
A: 

Hi James, I need to accomplish the exact same thing here.

How did you go about doing this in the end?

Riaan
@Riaan: Basically what I did was built a windows service which peridically (every minute for mine as my time was adjustable to the minute) got the current UTC time, converted it to local time based on the timezone and processed if the time was the scheduled time.
James