.NET intorop TimeZone object ToLocalTime not working?

CHTRCHTR Member Posts: 4
edited 2011-10-27 in NAV Three Tier
I am trying to get the local time on the server based on a DateTime from the database like:

TimeZone := TimeZone.CurrentTimeZone;

LocalTime := TimeZone.ToLocalTime(in_DT);

Name DataType Subtype Length
TimeZone DotNet 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.TimeZone

in_DT is the DateTime I want to convert, and LocalTime is the resulting DateTime.

The returned LocalTime is exactly the same as in_DT...

Somebody have an idea what is wrong?

Comments

  • CHTRCHTR Member Posts: 4
    As it turns out, from further testing, the CurrentTimeZone is setting the TimeZone to what appears to be the wrong time zone (actually W. Europe Standard Time - which I guess is UTC + 0).

    When I log into the server in question, I am seeing the right time - so I guess it may be a question of the root policy in the domain... Or?

    On a related note; for some reason the version of the mscorlib states 2.0.0.0? And sure enough there is 3.5 functionality missing (like TimeZoneInfo). Is there some way to use a higher version of mscorlib?
  • CHTRCHTR Member Posts: 4
    I guess nobody has replied. This is no longer an issue, since I just found the R2 feature WebServicesDefaultTimeZone, which does exacly what I wanted :roll:

    I still would like to know why I can only select the 2.0.0.0 version of mscorlib though... If anybody happens to know?
  • SavatageSavatage Member Posts: 7,142
    Adding a llink in this post:
    Time zones usage in Microsoft Dynamics NAV web services

    http://blogs.msdn.com/b/nav/archive/201 ... vices.aspx
Sign In or Register to comment.