I noticed the following problem. It is a serious problem for time registration systems.
I have 3 fields:
Registration date format dd/MM/yyyy
Time start format HH:mm
Time end format HH:mm
After entering the registration date, user must enter the time start field.
Since time-start field is of type HH:mm, I see in the debugger the following when entering 06:00 as time: Thu Jan 01 06:00:00 CET 1970
Before writing the value to the database I want to put the registration date into this field to replace 01/01/1970
After doing the following code:
var _time = new Date(registration_time_start)
_time.setFullYear(registration_date.getFullYear())
_time.setMonth(registration_date.getMonth())
I see that the time_start field has been changed to: Tue Sep 01 07:00:00 CEST 2009
Of course that is not what I want!
To make time-start en time-end fully datetime fields is not an option for the customer, because I know that could solve this problem.
I need a solution that puts the correct datetime in my field.
var _starttime = new Date(registration_date.getFullYear(),
registration_date.getMonth(),
registration_date.getDate(),
registration_time_start.getHours(),
registration_time_start.getMinutes(),
registration_time_start.getSeconds());
var _endtime = new Date(registration_date.getFullYear(),
registration_date.getMonth(),
registration_date.getDate(),
registration_time_end.getHours(),
registration_time_end.getMinutes(),
registration_time_end.getSeconds());
registration_time_start.getHours() returns 8 like expected.
Now I use the following coding:
var _time = new Date(registration_date.getFullYear(),
registration_date.getMonth(),
registration_date.getDate(),
registration_time_start.getHours(),
registration_time_start.getMinutes(),
0);
And the variable _time shows: Thu Sep 10 09:00:00 CEST 2009
When I use 01/01/2009 as date, then the correct time is shown (Thu Jan 01 08:00:00 CET 2009)
So it has something to do with the summertime.