These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Auto populate Date and Time field

Maday
Registered: Feb 3 2010
Posts: 8
Answered

I am new to live cycle and having a bit of trouble with a form i have to create for work. Getting the date and time field to auto populate and combined as one in the following format MM/DD/YYYY - HH:MM (24 hour)and be editable if the user needs to. I have very little knowledge in html, xml, and js so if anyone can help me with the code and where to put the code would be great.

Thank you

pforms
Registered: Nov 17 2009
Posts: 87
----- form1.#subform[0].DateTimeField1::initialize - (FormCalc, client) ----------------------------

TimeFmt()

----- form1.#subform[0].DateTimeField1::ready:layout - (FormCalc, client) --------------------------

$.rawValue = Concat(Num2Date(Date(), "MM-DD-YYYY"), " ", Num2Time(Time(), "HH:MM:SS"))



Set value tab to Calculated - User can override
Maday
Registered: Feb 3 2010
Posts: 8
When entering in the script i keep getting syntax failed near token.

Thank you
pforms
Registered: Nov 17 2009
Posts: 87
Make sure it's set to FormCalc
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You need to format the date and time individually and then concatenate the result with the separator. You can do all of this with just the calculation.

// Current Date  in "MM/DD/YYYY" format .var cDate = Num2Date(Date(), "MM/DD/YYYY")// Current Time in "HH:MM" format.var cTime = Num2Time(Time(), "HH:MM")// Create final formatted string.$.rawValue = Concat(cDate, " - ", cTime)

George Kaiser

Maday
Registered: Feb 3 2010
Posts: 8
Thank you for all your help Pforms and gkaiseril.