This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - aras date field value is stoed less than one day in sql

rrt - Monday, November 7, 2016 3:44 AM:

i have date field on item form

i select date 07/06/2016

but it store as 07/05/2016 in sql



Yoann Maingon - Monday, November 7, 2016 4:42 AM:

Can you precise the datetime selected (including hours and miuntes) and the one shown?

Aras uses UTC as a neutral datetime. So depending on the moment of the day you set the date, the UTC can be different

You can run a conversion like this :

this.getInnovator().getI18NSessionContext().ConvertFromNeutral(DATE,"yyyy-MM-ddTHH:mm:ss");



rrt - Monday, November 7, 2016 5:07 AM:

hii Yoann Maingon

i take one field which data source is data and pattern is shortdate

i want to show date as mm-dd-yyyy on form but save correctly in sql


but it save one day less in sql database

as per your solution

this.getInnovator().getI18NSessionContext().ConvertFromNeutral(DATE,"yyyy-MM-ddTHH:mm:ss");

where to write above code in form load or other event

 



Yoann Maingon - Monday, November 7, 2016 5:22 AM:

Why do you care about the SQL date? it is saved correctly with a neutral date that's it.

Give us a clear example of a datetime selected and how it appears in SQL.

 



rrt - Monday, November 7, 2016 6:03 AM:

as i fetch data from sql for ssrs report

in ssrs report date is come from sql

suppose i select date as following

in above picture i select date 10-25-2016 no matter of date format

as 10 -is month

25-is date

as in sql day is 24  (no matter of date format)



Yoann Maingon - Monday, November 7, 2016 7:55 AM:

When you select the date a time shows up. (I think usually, whatever the date it takes the time (HH:MM:SS) of the actual moment you select the date.)

Can you tell me which time it is?



rrt - Tuesday, November 8, 2016 1:39 AM:

its my system time when i select date

but problem with date



Yoann Maingon - Tuesday, November 8, 2016 2:18 AM:

what I need is the date you entered and the date you see in SQL 

both as DD/MM/YYYY hh:mm:ss So I can tell the precise difference



rrt - Tuesday, November 8, 2016 2:33 AM:

as date field pattern is short date so it look like mm-dd-yyyy in aras form   , date is 10-25-2016

and in sql it look as yyyy-mm-dd hh:mm:ss  ,  date is 2016-24-10 18:30:00:00

when aras item save , date i entered 10-25-2016 (as see on aras form due to short date pattern) in form

is save in sql with one day less than selected date

 



Yoann Maingon - Tuesday, November 8, 2016 2:41 AM:

and the datetime time in sql is always 18:30?



rrt - Tuesday, November 8, 2016 3:19 AM:

yes it remain 18:30:00

as my field pattern is shortdate i cannot pick time for it