DateTime_PrettyFormat not in sync with client time !?

I've built a pretty simple app, one of th escreens displaying entered orders (see screenshot). One of the displayed fields in the list is the Order Start (of type DateTime) using 

DateTime_PrettyFormat(OrderTable.List.Current.Order.Start)

The time I entered is 15:11 and the client time is 15:08. DateTime_PrettyFormat displays this as 15:11 (in 2 hours).

Can anybody explain to me why the 'in 2 hours'?

I expect that if I enter a DateTime around the current time, save it and display it again, there shoudn't be a difference of 2 hours.


The screenhot ....

Hello Charles,

A few questions to help solve this problem:

  • What timezone are you currently in?
  • Are you on-premise, or using OutSystems Cloud?
    • OutSystems Cloud uses UTC
    • If On-Premise, what timezone are your servers configured as?

Expounding a bit on what Craig said, the time on the webserver has nothing to do with the local computer time. The server has a clock which all of CurrDateTime() calls are based on. This is almost always UTC +0, which is the standard. 

If you are working with time zones you should create methods to convert times to and from that timezone so that users can see times in a format they expect. you could use a Forge component like this.

https://www.outsystems.com/forge/component-overview/500/time-zone

BTW, if you go to Service Center, you can view the current server time for that environment in the Box on the right.

Hi Craig, Jordan,

I'm just using my personal OutSystems cloud environment, located in The Netherlands. Went to ServiceCenter and a 2 hour difference between the server and my client.


  The simple app I built doesn't have anything to do with time zones. The example I showed is nothing more than scaffolded functionality for creating and displaying Order records, using CurrDateTime() for the timestamp.

As you can see in the example above the displayed time is correct (15:11) but DateTime_PrettyFormat adds (in 2 hours) to it, but that's compared to the server time, not the client / saved time. 


Hi Charles,

Unfortunately, the whole timezone business is not the strong suit of OutSystems. If you create a web app, then all processing is done server side, but date/times are stored in the database as-is, without conversion. So if you enter a date/time in the database in a different timezone than the server is in (which is pretty much always the case when using a PE), the server sees an offset to its local time - hence the problems with DateTimePrettyFormat(). The only advise I can give you is to give up on the "pretty" formatting, and just display the date/time as-is. The alternative is using timezone corrections, but that takes a lot of manual labour, and imho isn't worth it if you're not actually dealing with different (client) timezones.

Thanks Kilian, already thought this was going to be the outcome of my problem.
So, I'll have to eliminate DateTime_PrettyFormat from my list of handy built-in functions :-)
Regards, Charles

I usually end up using moment.js client side to adjust any date/times into the user's local time.  Not ideal, but it works.