39
Views
3
Comments
Time field value  is changing
Question

Hi Team, 

I recieve time slots from the response of Api as 2022-10-01T8:00:00+1:00 but when we include that api action in the server action we get different time values from server action adding 4:30hrs and displaying as 2022:10:T12:30:00+1:00, how to display the same time that we receive in the response of the api by avoid adding 4:30 hrs. 

2018-10-29 08-31-03
João Marques
 
MVP

Hello,


Are you in UTC + 4h30? A date time is converted automatically to the client timezone (in other words, if my computer is 2 hours ahead of UTC it will present the date time 2 hours ahead).

You can easily work around that behavior making the server action return to the client an attribute Date and an attribute Time. Those don't get automatically converted to the client timezone.

This behavior is explained, with examples, on the article Using time to our advantage in OutSystems.


Kind Regards,

João Marques 

UserImage.jpg
karthimani R

Hi Marques, 

My time zone is IST(Indian Standard Time) but i am working for uk client, hence whatever datetime in the response that i recieve should be displayed with same datetime values instead it is changing by adding 4:30 hrs when I use in normal browser but if I open the application through vpn it's working fine but I need that datetime should display the same without the vpn. 

2018-10-29 08-31-03
João Marques
 
MVP

Hi R.kar,


The behaviour that you are experiencing is what I have just explained it to you: a DateTime type value will be automatically converted to the client timezone.

Have you tried what I suggested? Instead of getting the date time in the client side, transforming the DateTime into a Date and Time attributes, so that they don't get automatically converted when they reach the client-side...

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.