ken bohnenkamp
1st September 2015, 05:24
I would like to convert a time in an eastern time zone to a time in a central time zone and then show it in a report. Does someone know an easy way to do this and what the syntax would look like ? I have looked at UTC functions but they are not real intuitive on what the syntax would look like. Does anyone have some code examples of how you can convert times in different time zones ?

bhushanchanda
1st September 2015, 09:46
Hi,

Use get.time.zone() and set.time.zone() functions.

e.g.

domain tcdate dt
string tz(50)

dt = utc.num()
get.time.zone(tz) |# This will store your current time zone into tz
set.time.zone("America/Chicago") |# Set the required time zone


This will change the value of dt variable according to the required timezone at runtime.

ken bohnenkamp
1st September 2015, 15:23
Whenever I use the functions, I get the errors
unresolved reference to functions get.time.zone and set.time.zone

bhushanchanda
1st September 2015, 17:20
Hi,

In that case, you might need to do it manually by adding/subtracting hours/mins from the current time in your current time zone.

Else, you can wait for a Baan 4 person to provide a working solution for this.

günther
3rd September 2015, 10:24
Hi Ken.

Since you are on Unix, you could set TZ and parse the output of date, e.g.

$ TZ=MEZ-1MESZ date
Thu Sep 3 09:19:04 MESZ 2015
=> If TZ is "MEZ-1MESZ", then it's now 09:19:12.

$ TZ=MEZ date
Thu Sep 3 07:19:12 MEZ 2015
=> If TZ is "MEZ", then it's now 07:19:12.

Regards
Günther