.NET intorop TimeZone object ToLocalTime not working?

CHTR
Member Posts: 4
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?
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?
0
Comments
-
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?0 -
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?0 -
Adding a llink in this post:
Time zones usage in Microsoft Dynamics NAV web services
http://blogs.msdn.com/b/nav/archive/201 ... vices.aspx0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions