My input datetime different with database datetime
Question

Hello All,

Currently im building this app, and in this app it have input with Date Time type,

Example : in the input like this,

but in the database it saved as 

it having different 7 hours ago,
My question is, how to saved the date time input to database same as the input.
So, if the input is 08:31, then in the database it also show 08:31,not 7 hours ago.

And if possible, can you share the simple oml about this?
Thankyou verymuch guys!!

Best Regards,
Ran

Solution

Hello @Bhetrand Dwilangga

You can use AddHours() function during insertion of the record in the table.

thanks
 

Hello, Ekjot
When i used AddHours() function, yeah it show right result on database, but it's also affect on my data inputted, my data input also added.
I want to add at database, but the input still same..is it possible?

Hello @Bhetrand Dwilangga ,

not the best way but you need to use Addhours() in both side during insertion and while displaying. if the 7 hours difference is fixed.

 

Additional,

It will affect on my program when the date time input is 14 Jun, 5:00 AM, then in the database it will appear 13 Jun, 22:00 PM. 

Solution

Hello @Bhetrand Dwilangga

You can use AddHours() function during insertion of the record in the table.

thanks
 

Hello, Ekjot
When i used AddHours() function, yeah it show right result on database, but it's also affect on my data inputted, my data input also added.
I want to add at database, but the input still same..is it possible?

Hello @Bhetrand Dwilangga ,

not the best way but you need to use Addhours() in both side during insertion and while displaying. if the 7 hours difference is fixed.

 

Hi Bhetrand,

Most likely your server time and your client device time is on different time zones. 

One way of doing this is to keep the dates stored in database as is and every time you process/display  these dates to UI you have to convert it to your client device's time zone using this forge component https://www.outsystems.com/forge/component-overview/2199/timezonereactiveutils

Another way is you convert all your dates to client device's time zone which to me is not advisable. As there are more things you need to consider like converting the result of CurrDate() or CurrDateTime() every time you use it and also the schedules of your timer.

Thanks,

Arnold

Thanks for your suggestion and recommendation Arnold,
i will try it


Best Regards,
Ran

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