Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Current date & time in text field

Avatar

Level 2

I need to auto-fill a text field with four letters plus the current date and current time. The text field should populate when the user clicks a checkbox.

For example, if today is April 25, 2012 and the current time is 10:27 a.m., the text field should read: UNIS0425121027.  (The time can be in military time or not - it doesn't matter.)

Thank you in advance for any help you can offer.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Try the following in the initialize event of the text field.

Change the script language to FormCalc.

TextField1.rawValue = Concat("UNIS",Num2Date(Date(),"MMDDYY"),Num2Time(Time(),"HHMM"));

Thanks

Srini

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Try the following in the initialize event of the text field.

Change the script language to FormCalc.

TextField1.rawValue = Concat("UNIS",Num2Date(Date(),"MMDDYY"),Num2Time(Time(),"HHMM"));

Thanks

Srini

Avatar

Level 2

Thank you!  I actually put that script on the "click" event of the checkbox and it worked just fine.