Web service : DT2TIME conversion error

titofffffff
Member Posts: 2
Hi,
I have an error with DT2TIME function while I use Web Service.
I use this table :
I have exposed this table as Web Service using a page.
I use this c# code in order to insert data :
When I execute the c# program I have this result in Nav table :
If I try this configuration :
client : GMT+1
server : GMT
I have this result :
So, I suppose Web service server must have GMT time zone.
Is there any other solution ? Configuration on Nav Server ?
Thanks
I have an error with DT2TIME function while I use Web Service.
I use this table :
OBJECT Table 50000 testDate { OBJECT-PROPERTIES { Date=22/11/09; Time=01:37:37; Modified=Yes; Version List=; } PROPERTIES { OnInsert=BEGIN tdate := DT2DATE(tdatetime); ttime := DT2TIME(tdatetime); END; } FIELDS { { 1 ; ;tdate ;Date } { 2 ; ;ttime ;Time } { 3 ; ;tdatetime ;DateTime } } KEYS { { ;tdate,ttime,tdatetime ;Clustered=Yes } } FIELDGROUPS { } CODE { BEGIN END. } }
I have exposed this table as Web Service using a page.
I use this c# code in order to insert data :
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestDate { using TestDate_Service; class Program { static void Main(string[] args) { testWs_Service ws = new testWs_Service(); ws.UseDefaultCredentials = true; testWs t = new testWs(); t.tdatetime = DateTime.Parse("24/01/1981 10:00:00"); t.tdatetimeSpecified = true; ws.Create(ref t); testWs t1 = new testWs(); t1.tdatetime = DateTime.Parse("24/01/1981 10:00:00").ToUniversalTime(); t1.tdatetimeSpecified = true; ws.Create(ref t1); testWs t2 = new testWs(); t2.tdatetime = DateTime.Parse("24/01/1981 10:00:00").ToLocalTime(); t2.tdatetimeSpecified = true; ws.Create(ref t2); } } }
When I execute the c# program I have this result in Nav table :
tdate ttime tdatetime 01/01/80 10:00:00 01/01/80 11:00 02/01/80 09:00:00 02/01/80 10:00 03/01/80 10:00:00 03/01/80 11:00In this case, server and client are in the same time zone GMT+1.
If I try this configuration :
client : GMT+1
server : GMT
I have this result :
tdate ttime tdatetime 01/01/80 10:00:00 01/01/80 10:00 02/01/80 09:00:00 02/01/80 09:00 03/01/80 10:00:00 03/01/80 10:00
So, I suppose Web service server must have GMT time zone.
Is there any other solution ? Configuration on Nav Server ?
Thanks

0
Comments
-
titofffffff wrote:So, I suppose Web service server must have GMT time zone.
You are is correct. Service tier always returns time in GMT, and there is no config for that. The application using (I just don't like work 'consuming') web services must perform conversion to the local (to the calling application) time zone.
There is good reason for this - how would web service tier serve requests from two or more applications working in two different time zones ?
Regards,
slawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030
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