How can i display the current date and time in a field with date type. I can show the current date with today() but how can i display the current time. Furthermore i want display these two in one field.
Thanks for every help. Felix
How can i display the current date and time in a field with date type. I can show the current date with today() but how can i display the current time. Furthermore i want display these two in one field.
Thanks for every help. Felix
I am afraid that is not possible as a field of type date
holds just that - the date. Use type utcdatetime
and the appropriate control UtcDateTimeEdit
to show dates & times in one control.
To retrieve the current date & time you can call DateTimeUtil::utcNow()
to which you may want to apply the local time zone via DateTimeUtil::applyTimeZoneOffset
Try this:
utcDateTime _utcDateTime;
;
_utcDateTime = DateTimeUtil::getSystemDateTime();
Then you can extract separately the date and the time if you want.