Insert current time on form submit

Hello.

I have created a form which is using the system date as an initial value in a field set as time which works perfectly, but the time will always be the time the form was loaded in the users browser.

I need to the time be exactly when the user submits the form, can the time be set when the form is submitted?

image

On before insert, set that field to = current date or date/time.

Thank you, i have tried the following code:

$visitor_timein = time();

But it inserts a weird time into the database.

83:00::5

Hello,

Do you have tried from backend option in your form ?

This is a screenshot in french, sorry :

1 Like

Thank you, i tried this but i think this only works on update and not when adding a new record via the form

Personally I use it when creating a new form and it works. I store the date and not the time.

When updating, I store the date like this :

{date_modification} = date("Y-m-d");

But it should also work with the time.