Forums

Show date and time from DB in a form (CF5)

thewelt 04 Jan, 2018
Hi,

I have a DB table wich automatically updates the datetime upon editing a record using a form in CF5.
Now I would like to show that datetime (last modified data) into the form.

How can I do that?

Tnx,
Bart Weltens - Belgium
GreyHead 04 Jan, 2018
Hi Bart,

Add a custom Code element with HTML like this:
<p>Site last updated on {date_modified}. </p>
But replace date_modified with the column name from your table. You may also want to re-format the date to make it more user friendly.

Bob
thewelt 04 Jan, 2018
Tnx Bob,

Any suggestions on how to make ik more user friendly?

Bart Weltens
GreyHead 05 Jan, 2018
Hi Bart,

What is the format of the saved date that you are loading?

Bob
thewelt 05 Jan, 2018
Hi Bob,

In de DB it is saved as 2018-01-05 17:08:45.

Bart
thewelt 08 Jan, 2018
Hi Bob,

How do I "transform " the date 2018-01-05 17:08:45 to for example 05-01-2018 at 17:08 ?

Tnx,
Bart
thewelt 09 Jan, 2018
Tnx for your aswer Bob.

But where in my form do I put this code in CF5?

Bart Weltens
GreyHead 15 Jan, 2018
Hi Bart,

In a Custom Code action after the DB Read action and before the HTML (render form) action.

Bob
This topic is locked and no more replies can be posted.