You are not logged in.
Pages: 1
hi,
i use a tdatetime for a tsqlrecord's property.
when i save just a tdate value in the database table i find correctly just the date value but if i save a null tdate value in the database table i find the time saved with timestamp.
i.e.
|TDateTimeField
|----------------
|2013-07-31 <---- saved passing a tDate value
|T12:23:08 <---- saved passing a null tDate value
why??
thanks,
Emanuele
Offline
What is a TDateTimeField?
Are you using the VCL wrapper?
How do you set "null" to a mORMot field (there is no such "null").
I do not understand your problem.
Perhaps it is an issue in the TClientDataSet itself.
Offline
sorry, i explain wrong...
for TDateTimeField i mean a property of a TSQLRecord declared as TDateTime.
when i pass a Date value i find exactly the date i set (and only the date!)
when i pass a null Date (30 dec 1899) i find in database only the time (correctly dont save the date, but why the time???)
i hope that now the problem its clear.
thanks
Offline
SQLite
Offline
No, i have for example 'T11:08:10'
Offline
i assign date form tdatetimepicket like this
myTSQLRecord.myDateTime := myTDateTimePicker.Date;
why in database i find the time?
Offline
when i told that in database i find its because i'm looking with SQLite Database Browser too...
Offline
I had a similar problem and it seems TDateTimePicker.Date also includes a time part.
Try: trunc(myTDateTimePicker.Date)
Offline
thanks ab and esmondb!
the problem its TDateTimePicker so i make some test.
put TDateTimePicker on form and set kind property to dtkDate and Time property to null.
run the program.
all seems ok until i disable and re-enable the TDateTimePicker. In this case Time value is set to current time!
i work around with esmondb solution ---> trunc(TDateTimePicker.Date)
thanks again,
Emanuele
Offline
More accurately to use DateOf function from DateUtils unit.
Call DateOf to convert a TDateTime value to a TDateTime value that includes only the date information (sets the time portion to 0, which means midnight).
Offline
Pages: 1