Fixed starting program after midnight

If the program was started between midnight and the time to switch over
to the next day, the current date would be used, instead of the previous
day, which caused problems with using the wrong service class for
schedules. Now if the program is started in that time, the date is
changed to the previous day.