Different times Platform Server and running app 

Different times Platform Server and running app 

  

Dear Community,

My Company Outsystems server is located in Asia but the application is used in Europe.

Among other things, the app sends mails. Because Asia is in a time zone +6 hours than Europe, if a mail is send after 18:00 in Europe, the date of the mail is from next day.

How to solve this?  My first idea was to use the function AddHours with -6, but where the server is doesn't have daylight savings, which means we have to change the code twice a year.

Shall I use the Time zone module from forge? If so, how? Or use Site Properties? If so, how?

Any suggestions?

Thanks

Hi Jorge,

I'm assuming that you cannot change the timezone on this server.

You can use the action 'ConvertFromTimeZone' passing in the server's timezone and the timezone the application is running (ideally a site property to be able to change on the fly). This should handle all the conversion for you.

I am not positive about the daylight savings, but I am pretty sure this handles the daylight savings as well, but you would need to do some testing.

Justin

Justin Babel wrote:

Hi Jorge,

I'm assuming that you cannot change the timezone on this server.

You can use the action 'ConvertFromTimeZone' passing in the server's timezone and the timezone the application is running (ideally a site property to be able to change on the fly). This should handle all the conversion for you.

I am not positive about the daylight savings, but I am pretty sure this handles the daylight savings as well, but you would need to do some testing.

Justin

Hi Justin,

Sorry for the late reply.

I'm struggling with the ConvertFromTimeZone() function parameters. What am I supposed to place there?

At this point, my app is quite simple:

On the first label, I show the server Current Date Time (using in value  CurrDateTime()).

On the second label, I want to convert the server date time to a specific Time Zone (in my case to UTC +01:00).

How do I do that?


Solution

Hi Jorge,

Did you take a look at the demo page of the TimeZoneConversion?
The action ConvertFromTimeZone() needs 3 input parameters. 

  1. SourceDateTime
  2. SourceTimeZone
  3. DestinationTimeZone

So if I would like to convert a DateTime from my Server (UTC Time) to my Local Time (GMT+2) I would use the following parameters:

  1. CurrDateTime()
  2. "UTC"
  3. "W. Europe Standard Time"

If you would like a list of all TimeZones you would use: GetSystemTimeZones

Kind Regards,
Martijn Habraken


Solution

Hi Jorge,

You have to provide source and destination timezone Identifier and it will give you converted date time.

See the screen shot below

Sachin

Martijn Habraken wrote:

Hi Jorge,

Did you take a look at the demo page of the TimeZoneConversion?
The action ConvertFromTimeZone() needs 3 input parameters. 

  1. SourceDateTime
  2. SourceTimeZone
  3. DestinationTimeZone

So if I would like to convert a DateTime from my Server (UTC Time) to my Local Time (GMT+2) I would use the following parameters:

  1. CurrDateTime()
  2. "UTC"
  3. "W. Europe Standard Time"

If you would like a list of all TimeZones you would use: GetSystemTimeZones

Kind Regards,
Martijn Habraken


Thanks Martijn. Right to the point!


Martijn Habraken wrote:

Hi Jorge,

Did you take a look at the demo page of the TimeZoneConversion?
The action ConvertFromTimeZone() needs 3 input parameters. 

  1. SourceDateTime
  2. SourceTimeZone
  3. DestinationTimeZone

So if I would like to convert a DateTime from my Server (UTC Time) to my Local Time (GMT+2) I would use the following parameters:

  1. CurrDateTime()
  2. "UTC"
  3. "W. Europe Standard Time"

If you would like a list of all TimeZones you would use: GetSystemTimeZones

Kind Regards,
Martijn Habraken


Hi Martijn,

On my personal environment it worked well. But my company server is in Singapore. What is the Source TimeZone for Singapore?

Thanks in advance


Jorge Vilar wrote:

Martijn Habraken wrote:

Hi Jorge,

Did you take a look at the demo page of the TimeZoneConversion?
The action ConvertFromTimeZone() needs 3 input parameters. 

  1. SourceDateTime
  2. SourceTimeZone
  3. DestinationTimeZone

So if I would like to convert a DateTime from my Server (UTC Time) to my Local Time (GMT+2) I would use the following parameters:

  1. CurrDateTime()
  2. "UTC"
  3. "W. Europe Standard Time"

If you would like a list of all TimeZones you would use: GetSystemTimeZones

Kind Regards,
Martijn Habraken


Hi Martijn,

On my personal environment it worked well. But my company server is in Singapore. What is the Source TimeZone for Singapore?

Thanks in advance


Found out:

ConvertFromTimeZone(CurrDateTime(),"Singapore Standard Time","W. Europe Standard Time")