Project Server: Why do my date selections lose a day?

*** Update – should probably have mentioned this more prominently – but this DOES NOT affect schedule dates – just the display date ranges in Resource Plans. When I re-read it after posting I realised this might look quite alarming***

This was an interesting issue that Adrian Jenkins finally cracked – and I had seen postings on the forums and we had some internal customer cases.  It appeared to be related to time zones as the problem had only occurred in Europe and Eastward.  So if your time zone is left of Greenwich (Sorry – UTC) you probably don’t need to read any further.  But as this may work in reverse also – might just be worth seeing why this happened.

In my example below, I have my server and SharePoint farm running at UTC+2 – Athens, Bucharest and Istanbul (and others of course).  I’ve also set the regional settings to Greek (but don’t have the language pack) – just so the date format is the same format as most people this affects are using.   If you are in the Resource Plan and want to change the date range and say you select 1/12/2011 to 31/12/2011:


you will find when clicking OK that the actual dates are set to 30/11/2011 and 30/12/2011


Looking behind the scenes we can see that the actual date (and time!) saved is midnight.  This is persisted in the User Properties table – as it isn’t setting the resource plan start and end date – just the current window of dates that you wish to review.  Worth remembering that there can be stuff before and after these dates… but back to the plot.  These dates are stored in a numeric string representing the number of milliseconds since 1/1/1970.  Between selecting, saving and recalling there is a conversion according to the current time zone and basically it thinks that at midnight on whatever day you choose (assuming you are UTC+X)  – it was still yesterday at UTC! In reality the time stored is the UTC time taking in to account the time zone difference – so in my example I set 1/12/2011 (it assumes time of 0:00) but what was saved was actually 2 hours earlier 30/11/2011 22:00.

Easy workarounds – either put in the day after you really want – or add a time value to the string.  So I could enter:


and this would then give me the right dates.


This shouldn’t affect anyone West of Greenwich – however, if I put in a time here in the Pacific Time Zone that was after midnight UTC – such as 5pm, then my date would go forward to the next day!

Sorry for any confusion this has caused.  I should also point out that although I am specifically talking about the date range for the resource plan view this could also affect other pages too – but generally only dates persisted as part of a view.  Rest assured that in my testing it does not affect dates entered in the schedule grid.