7/11/2012

Converting Times to your Servertime in a Nutshell

A quick method to convert UTC DateTime to the current servers local time. I use this for a rest webservice that accepts UTC/GMT timestamps from an iPhone to make sure all times in the database are in the correct timezone, and still accurate. This code will go into the "input translation" section triggered by the "compute with form".

timestring := month+"/"+day+"/"+year+" "+hour+":"+minute+":"+seconds+" GMT";
time := @TextToTime(timestring);
result := @TextToTime(@TimeToTextInZone(time;@GetCurrentTimeZone;"D0T0"));

No comments:

Post a Comment