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. } }
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); } } }
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.
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
Comments
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,
slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03