Daylight Savings Time - Adding Hour

I’m working with the Basic Scheduler in MVC3 and have enabled


in my dhtmlxscheduler.js

The problem I am running into is that when I save an event that starts at 12:00AM, it saves it in the database as 06:00:00. The time should actually be 5AM, since I’m 5 hours behind UTC/GMT, not 6 hours. I’ve confirmed on my computer that I am indeed setup for Daylight Savings Time.

I have another piece of code I wrote to test out proper UTC that gives me the correct offset (5 hours):

return (new Date()).getTimezoneOffset().toString();

Why does the scheduler think I am 6 hours behind GMT when I’m really 5 hours behind GMT?

I would suspect something fishy going on here:

return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());



What is the name of your timezone ?
Can you add some debugging code and confirm that incorrect data is sent from client side ( as database can do time-conversion on its own ) ?

Also, beware that if you are creating event in future or past - scheduler will use DayLightSaving setting from that time ( for example - it may be that your timezone have 5 hours for a summer and 6 hours difference relative to GMT for a winter )

I had my controller initializing the scheduler to a date in the past! Not paying attention, as I added events, I was only focusing on the time and not the date. Such a simple mistake, but thank you for bringing it to my attention!