none
Word 2010 custom properties and time zone settings RRS feed

  • Question

  • Hello,

    I'm working on Addins for Office 2010 (with Sharepoint 2010 as backend), one Addin creates custom properties in Word documents, some properties are DateTime.

    Last week we change Time Zone configuration due a DayLight change and now we have some documents with problems in custom properties with dates.

    So after some tests I found this for one year:

    System.TimeZone.CurrentTimeZone.GetDaylightChanges(2010)

    {System.Globalization.DaylightTime}

         Delta: {01:00:00}

        End: {14/03/2010 2:00:00}

        Start: {07/01/2010 0:00:00}

    BUT the start DayLight date for 2010 was 02/10/2009 (October 09), the Time Zone configuration it's ok so I don't know whats happen.... any ideas??

    thanks!


    Mauricio

    Tuesday, October 20, 2015 8:25 PM

Answers

All replies

  • Hi Mauricio,

    >>Last week we change Time Zone configuration due a DayLight change and now we have some documents with problems in custom properties with dates.<<

    Based on my understanding, the TimeZone is relative to the system settings. Please ensure the TimeZone is set correctly. You can show the TimeZone via code below:

    TimeZone.CurrentTimeZone.DaylightName;
    TimeZone.CurrentTimeZone.StandardName;

    Also I suggest that you try to reproduce this issue via creating console application. Because, based on my understanding, there is not settings would affect the TimeZone in Word application. If you still have the issue about using this class, you can try to reopen a new thread in .NET Framework Class Libraries forum.

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 21, 2015 5:38 AM
  • Hello,

    yes, I already tried this code in console, I suspect that TimeZone settings could be wrong at registry level (at user level is set the correct Time Zone)....

    why this "System.TimeZone.CurrentTimeZone.GetDaylightChanges(2010).Start" return 07/01/2010 0:00:00???

    thanks for your help!!


    Mauricio

    Wednesday, October 21, 2015 1:35 PM
  • Hi Mauricio,

    >>yes, I already tried this code in console, I suspect that TimeZone settings could be wrong at registry level (at user level is set the correct Time Zone)....<<

    Can you reproduce this issue in the console application? If yes, I suggest that you share the current time zone with us and I would help you move this thread to the .NET Framework Class Libraries forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 22, 2015 7:09 AM
  • Hi,

    ok, my Time Zone is "(UTC -03:00) Montevideo", thanks for moveing this to the right forum.

    Console TimeZone

    thanks!


    Mauricio

    Thursday, October 22, 2015 1:11 PM
  • Hi MauricioUY,

    As document said. Because the TimeZone class supports only one daylight saving time adjustment rule, the GetDaylightChanges method applies the current adjustment rule to any year, regardless of whether the adjustment rule  actually applies to that year.

    To summarize, GetDaylightChanges will give you inaccurate results.
    https://msdn.microsoft.com/en-us/library/system.timezone.getdaylightchanges(v=vs.110).aspx

    @Rajeev Goel provide a workaround to get right DaylightChanges. See below article.
    http://stackoverflow.com/questions/29981072/net-timezone-currenttimezone-getdaylightchanges-returns-wrong-dst-for-2005

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 23, 2015 7:52 AM
    Moderator
  • Hi Li Wang, thanks for your answer.

    so, ok, with this sample I could test that my Time Zone configuration is right:

    so, maybe now I need to move this post to another forum, because when I open a Word document from Sharepoint 2010 and load the ContentTypeProperties, one of DateTime properties has "2010-11-01 15:45:00.000", BUT in Sharepoint DataBase the value is "2010-11-01 18:45:00.000", so If I'm not wrong the correct value in the contentTypeProperties should be "2010-11-01 16:45:00.000" (because daylight is -2 and standardtime is -3)....

    any ideas??

    thanks a lot!


    Mauricio

    Friday, October 23, 2015 1:37 PM
  • Hi MauricioUY,

    For new question, I suggest you create a new thread.

    Thanks,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 27, 2015 5:28 AM
    Moderator