Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Can't get auto-populated current date & time field to show in correct way

lostfrogg
Level 3
Level 3

I've added a "Date/Time Field" to my form. In the value tab, type is "calculated - read only". Runtime property is "Current Date/Time". 

If I go to "patterns" and select a particular type under both "display" and "data" (e.g. April 01, 2007 3:30:47 PM) and click OK, then go to the "preview PDF tab", the data is shown as "2020-08-23 10:08:17". Why isn't it showing the date & time in the way I chose?

Also, I want it to show the date & time when the user opens the form to fill it in. I don't want it to update this when I receive the form and open it to view it - is this possible?

1 Accepted Solution
Rakhi_Sukhadeve
Correct answer by
Level 2
Level 2

@lostfrogg  If you set Runtime property as "Current Date/Time", it calls the below FormCalc script in layout:ready event of the DatatimeField. If you want to change the display pattern, you can modify it here.

 

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

 

Also, if you want to show the date & time when the user opens the form to fill it, in that case, you can write a simple Javascript for fetching the current datetime and use it in the form initialize event.

 

I hope this is helpful.

View solution in original post

1 Reply
Rakhi_Sukhadeve
Correct answer by
Level 2
Level 2

@lostfrogg  If you set Runtime property as "Current Date/Time", it calls the below FormCalc script in layout:ready event of the DatatimeField. If you want to change the display pattern, you can modify it here.

 

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

 

Also, if you want to show the date & time when the user opens the form to fill it, in that case, you can write a simple Javascript for fetching the current datetime and use it in the form initialize event.

 

I hope this is helpful.

View solution in original post