none
Convert DateTime value returned by CSOM interface of Project Server 2013 to local time zone RRS feed

  • Question

  • I Use the CSOM interface to communicate with Project Server 2013.

    Below is a part of code that retrieves the project's LastSavedDate

     IEnumerable<PublishedProject> projects = Context.LoadQuery(
          Context.Projects.Where(x => x.Id == projectId)
            .Include(p => p.Id, p => p.Name, p => p.LastSavedDate));
                    Context.ExecuteQuery();
                    PublishedProject prj = projects.FirstOrDefault();
                    DateTime lastSavedDate = prj.LastSavedDate;

    lastSaveDate is now contains date time in the server's time zone (in my case: UTC-8:00): {1/11/2014 4:00:00 AM} 

    I need to convert it to my local time (UTC+3:00), so the time should be {1/11/2014 3:00:00 AM}.

    Difference is 11 house. Is there any way to do it?

    below is the all properties of the lastSavedDate:

    {1/11/2014 4:13:42 AM}
        Date: {1/11/2014 12:00:00 AM}
        Day: 11
        DayOfWeek: Saturday
        DayOfYear: 11
        Hour: 4
        Kind: Unspecified
        Millisecond: 750
        Minute: 13
        Month: 1
        Second: 42
        Ticks: 635250104227500000
        TimeOfDay: {04:13:42.7500000}
        Year: 2014


    AlexJ

    Saturday, January 11, 2014 1:05 PM