add time info to DateTime picked with only date

Login or register to post comments
No replies
grossini's picture
Offline
Joined: 01/05/2009

Sometime to short info requested in form only Date info are requested. In this case the date time file has time set as 00:00:00.

I found useful to replace this null time with current time, so if some date are entered the same day we can found correct cronology.

in save action of my table Autoletturekm for field DataIns, I added.

$this->objAutoletturekm->DataIns->setTime(date("H"),date("i"), date("s"));

note: to my limited knowledge, QDataTimePicker class refuse this setting ....

I suggest that in core is possible to add a similar functionality:

if (time portion of datatime object field is null (00:00:00) and autotime is on for the object field) 
set actual time.

//autotime is new attribute !!!!

Gianni