current Date time returning server time

Hello,

I am facing issue currDateTime() function.
It returns server side time . I do read about this issue in a lot of other posts. So I tried using a forge component TimeZone.
I could get the EST time after conversion but when I am sending the same time for saving in database it is converting it again into server time.
Here is how I am assigning the time.
Am I missing something?
Please help.

Thanks,
Anagha

Hi Anagha,


I did a test on my personal environment, and I can convert and save the converted date to the database without problems


See the attachment.


Regards

Pedro Costa wrote:

Hi Anagha,


I did a test on my personal environment, and I can convert and save the converted date to the database without problems


See the attachment.


Regards

Hey Pedro,

Thanks for looking into it.
In my case the same data is shown on a preview page(different page) before saving it in the DB.
So do you think this could be because the time is being sent as an input parameter to a different page and then is saved to db?

Thanks,
Anagha

Hi,

I think Pedro Costa is given the right solution as per your needs. You can create a server action and call it where it is needed.


Thank you,

Sudip

Anagha Chikate wrote:

Hello,

I am facing issue currDateTime() function.
It returns server side time . I do read about this issue in a lot of other posts. So I tried using a forge component TimeZone.
I could get the EST time after conversion but when I am sending the same time for saving in database it is converting it again into server time.
Here is how I am assigning the time.
Am I missing something?
Please help.

Thanks,
Anagha

Hi Anagha,

Please use below code

JobItem.CreateDate=if(forEdit,JobItem.CreateDate,ConvertFromUTC(JobItem.CreateDate,"Eastern Standard Time")

Hope this will help :)

Regards,

Amit

Hello,

This is still not working for me.
Now I tried to write the conversion logic right before the post call.While debugging i get the correct values assigned to the created date variable but when it passes in the request it is still taking the Portugal time zone.
Attaching the screenshot and the Post call request too.

While in debugging mode I am seeing this correct EST time assigned to the variable.


But this is what is going in the post call request text:
"createdBy":"achikate","createdDate":"2019-10-07T06:42:34Z","datePosted":"2019-10-07T06:42:34Z",

Still in portugal time zone.
What am I missing?

Thanks,
Anagha

Did anyone get to see this?
Really need help.

Thanks,
Anagha

Hi,

You can use the component available in Forge. Below is the link..

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

I hope it will help you to convert the server time to local time.

Please let me know ,

Thank you,

Sudip

Solution

Junaid Ahmed Syed wrote:

Anagha, please see this post, are you experiencing the same behavior?

https://www.outsystems.com/forums/discussion/27205/datetime-variables-changes-when-passed-from-client-to-server/

Hey,
This was exactly what my issue was.
I sorted it out by passing the date time as text field. But there should be a better solution to this i think.
Anyway, thank you everyone.

Regards,
Anagha


Solution