views:

48

answers:

1

I got this answer from Kjensen and read the answers, but this is a different webapp

I'm running scheduled events that process incoming orders, set Picking material, manage Track & Trace numbers, etc ... and I do this at a specific time of the day (set in Administration Panel)

My server is in UK (DiscountAsp.net) but I'm 2 hours ahead.

What I really wanted is, every time I call DateTime.Now that would be automatically changed to my time instead of Local Server Time. This should handle Daylight savings as well.

I thought about making a Extension to simply call DateTime.MyLocalTime and there use TimeInfo to add / subtract the correct hours.

In good old days I did this in Global.asa (ASP) ... I just wanted to know if there is a better way to handle this.

Thanks.

+7  A: 

Instead of saving to a particular timezone (IST, GMT, EST, etc), I find it a pretty good idea to store as UTC.

Storing as UTC simply removes the issues of the Daylight Savings boundaries - days with 23 hours or 25 hours.

Store user's timezone based either on their preferences, or auto-magically guesstimated.

Then do the arithmetic when you save and retrieve data and display appropriately.

Raj More