Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Automatically displaying date and time in a date/time field on form initialize


Level 5

Good day all;

I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.

I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.

I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…

Please let me know where I am going wrong


1 Reply


Level 5

Found the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.

You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.

When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.


In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.


In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.


Select the Runtime Property option.


View the form in the Preview PDF tab.