Setting task date with CSOM gets converted to USA format RRS feed

  • Question

  • Hi

    I'm setting a task start date using CSOM, and do it using a UK format (DD-MM-YYYY), but Project Server reads it as if it was in USA format (MM-DD-YYYY).

    As you can see from the pictures below, the value gets set correctly in my code, but then Project Server treats it as if it were in USA format.

    The date that I'm writing in the task:

    The date on the task after I write the date:

    The task as viewed in the PWA project schedule. As you can see although I wrote 05/12/2017, the date that appears on the schedule is 12/05/2017. You might think that it's just a viewing format, but take a look at the 4th picture:

    The date that the code reads in a 2nd run of the program (this is before the assignment of the parsedStarDate value, which is 05/12/2017). As you can see the date that PS stored on the task was in fact 12/05/2017:

    What's going on here? Is there a setting in Project/SharePoint that defines how it treats dates after being read from CSOM?

    Friday, August 5, 2016 11:36 AM

All replies

  • Bump
    Monday, August 15, 2016 9:18 AM
  • Hello Pedro Gordo!

    Please help me with similar issue. I found this problem when tried to set the value of start date and finish date (standart field). As I can see this problem is present only in standart fields with Date type. If I use custom fields with Date type this problem doesn't exist, but I need to use standart start and finish fields for my current task.

    How did you decide a similar issue in your case?

    Tuesday, January 17, 2017 8:17 AM
  • I also have this issue, using fiddler I can see that the datetime is correct when sent to the server

    <SetProperty Id="259" ObjectPathId="257" Name="Start">
        <Parameter Type="DateTime">2018-01-10T09:00:00.0000000+00:00</Parameter>

    This is the ISO8601 format used in XML, the date above is 10th January 2018. In PWA this is shown as 1st October 2018.

    I've tried following the instructions below to set the regional settings for the whole site, but this had no effect.

    If the task was newly created by me then the date format is incorrect, any dates that would generate an invalid date, i.e. 13th January that would turn into 1st of month 13, get reset to the project start date. If I update a task that already has dates set it is not converted, but it has a time added (start or end of the standard working day) which prevents the task appearing in the Gantt chart. 

    Sharepoint Central administration console shows Sharepoint Server 2013 is patched to SP1 (KB2880552) and PWA has SP! (KB2880553) and update KB3114723.

    Friday, January 5, 2018 12:01 PM