I have an object of type Time startWorkingTime and object of type DateTime nextBusinessDay. I want to create new object of type DateTime based on startWorkingTime and nextBusinessDay.
Here is my code:
DateTime startWorkingTime = DateTime.newInstance(nextBusinessDay.year(), nextBusinessDay.month(), nextBusinessDay.day(), currentStartHours.hour(), currentStartHours.minute(), currentStartHours.second());
After startworkingtime the time is set one hour earlier
For example in bold:
23:59:24:025 USER_DEBUG [188]|DEBUG|currentStartHours 09:00:00.000Z
23:59:24:025 USER_DEBUG [189]|DEBUG|currentStartHours.hour() 9
23:59:24:025 USER_DEBUG [197]|DEBUG|startWorkingTime 2017-08-04 08:00:00
Could you please explain why the hour in startWorkingTime is 08:00:00 and advise how to fix it?
Datetime.newInstanceGmt
? – Adrian Larson♦ Aug 3 '17 at 21:14