Insert date information to my database

Moving on – because I have lost so much time over this and have to Rush – how do just put the current time into a hidden field and submit to a standard datetime mysql column value?

Wappler shows a whole lot of options but I see nothing that just shows , for instance, the SERVER Local time.

What would I put here, please?

<div class="form-group">
  <label for="inp_regtime">Zeit</label>
  <input type="date" class="form-control" id="inp_regtime" name="regtime" aria-describedby="inp_regtime_help" placeholder="Enter Regtime" dmx-on:input="">
</div>

Now looking at

Date and Time

Happy the sessions are finally working, that’s awesome.

Easiest way to add the date time into your database is in the server connect insert or update step, whichever you are using.
So I wouldnt even bother with a hidden field, and a post variable for that input.
Open your insert server connect step and where you have the date time field, instead of binding it to a post variable, click the lightening bolt and find NOW or NOW UTC. Bind that instead and it should work fine

OHHHH wow, I had been looking for that!

Let me check – like another package under the shedding Christmas tree.

Okay

Open your insert server connect step

Duuh

This what I think I am supposed to do –

Well you trying to insert form data into a mysql database, so you must have some server connect action I assume that performs a database insert. Whatever server connect file that does that it should be in there.

Like this?

Double click this


Remove the $post completely and click the lightening bolt which will show bindings for NOW

1 Like

Perfect

If it does not work I would check your mysql field type to see if it can take that date format. Then either change your field type to something that will take it or use the formatter in the now UTC step to adjust it

Alternatively set the default to UTC_TIMESTAMP in your database field definition and dont bother sending the value at all, MySQL will add the current date for you

What I finally did after trying various suggestions
(I left the iput time field set as “date” in the form)

and getting various “What the hell are you trying now?” errors

I used Paul’s very direct approach with an alternate value

plain old {{NOW}}

(instead of showier UTC options)

made the mysql table happy

here is what I set in mysql — removing the Auto Update type in the table and simply leaving it as a timestamp but letting the data from the form throw the NOW() from the master TimeKeeper server on the isle of Malta.

Thank you everyone for putting down your hearty grogs of cheer and checking up on Grandpa.
07

Cool, glad you got it working.