Hi
My CurrTime() is 3 hours behind my local time, how to fix this?
Hello Faris.
You mean on the Cloud? That is standard.
In the OutSystems Cloud all servers are set to work in the UTC time zone. This configuration cannot be changed.
https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/OutSystems_Cloud_and_time_zones
There are some pretty good workarounds,
https://www.outsystems.com/forge/component-overview/500/time-zone
Nuno Reis wrote:
Yup, I just need to add 3 hours more on it, I downloaded the timezone component but how to do it?
this's my timezone identifier: Arab Standard Time
Hi Faris,
The TimeZone component contains a sample page that demonstrates the time conversions. You can look into the logic to see how it is done.
Regards,
Nordin
Nordin Ahdi wrote:
which action should I use for my problem
this one?
ConvertTimeZoneToIANA
The component includes an example and has all the actions you need.
You just have to convert between UTC and AST.
Yes I opened the component but I don't how to use those actions I tried to copy it into my project but it won't paste
Faris Abdullah Almozini wrote:
Just to be clear, you don't "Copy". You add them as References.
You need ConvertFromUTC and ConvertToUTC.
The OS server is in UTC to be clear for everyone. Just like aviation uses UTC for all international communication to avoid different local time issues.
I also did this multiple times but it does not show up on my project
The TimeZone extension is already added as a dependency in your module. You just need to click on the little arrow on the left for the actions to show up.
The TimeZone extension is already added as a dependency in your module. You just need to click on the litte arrow on the left for the actions to show up.
Wow sorry about that! I was looking at the server action :P
Ok, can you please tell me what to do now? I'm new to Outsystems
How to use ConvertFromUTC and ConvertToUTC and apply it to all the project
You have to:
Use the ConvertfromUTC function every time you wish to show a date to the user.
To do this I would create a block that converts input datetime.
Use the ConvertToUTC function every time you wish to save a user input date to the database.
To do this, configure your Create/Update actions to do the conversion and always use them instead of the default ones.
My first link has a lot of good resources.
How to create a block that converts input datetime?
I created the block
Hello.
Sorry for the delay. I made a small example of the block in Reactive you can look at.
No problem, I opened the file it seems like its for web app, will there be a problem if I use the block on a mobile app?
I used the block but still didn't make any difference, I would like to also mention that when I open the app on my device to shows the right time for a second than flip back to the server time.
Hi Faris Abdullah Almozini,
If your objective is to add +3 hours to the value obtained from CurrTime() function, you can achieve it by using the in-built AddHours() functions as mentioned below
Code Snippet
AddHours(CurrTime(), 3)
Note: AddHours() returns DateTime value so if you want to display only the incremented Time value you can wrap the AddHours() within the DateTimeToTime() function for value conversion as mentioned below
DateTimeToTime(AddHours(CurrTime(), 3))
See the sample app: DemoApp_UTC+3Hr
Hope this helps you!
Benjith Sam
Faris
The idea is that you look at the logic and implement the way you need it.
Regarding the "going but to UTC", it should only recalculate if parameters changed. Are you sending new parameters?
Benjith, this is not a simple "add x hours" issue. This is a "different time zone" issue. The difference can change over the year. because of Daylight Saving Time.
Even if it would fix Faris issue, it could be misleading to others looking for the same.
Hello Friend,
You can try put in Assign this command to your variable: AddHours(CurrDateTime(),-3)
Tom Nogueira wrote:
which variable you mean? do I have to create one for the date or just added to the enitity
Hi Faris Abdullah Almozini and Tom,
@Tom, Your suggestion is similar to what Benjith suggested above (and the correct is, like he mentions, to add +3h, since Faros' timezone is UTC+3), you may want to check Nuno's thoughts on the downside to do it that way, they are spot on.
@Faris Abdullah Almozini, are you still facing this issue after 2.5 months??
Since you seem to be creating a Mobile app (the same applies to Reactive apps btw), you shouldn't have to worry about timezones when using CurrTime() or CurrDateTime() at all:
The Timezone component is useful when, in your Server actions, you want to perform calculations with Time and DateTime values from multiple timezones (Nuno's info is quite complete, if this is what you need, just read it and see how the sample page was implemented on the Timezone component itself)
Hope this makes things clearer!