Recording time in a hidden field

I am having a real issue trying to record the time in a field in a form. Preferably as a hidden field

I have added the date and time component

I have tried every format in the table I can think of date datetime timestamp time and also text

I have given the field on the form a dymanic value of the Var1.datetime and also tried to format it to just the time (which shows in the field correctly)

I have tried addingas a text field and converting

I have tried to change the field to a datepicker and also timepicker using the checkbox

Everything I try just adds the date and not the time to the database 2020-04-06 or 2020-04-06 00:00:00

Please Help I really do not know what to do

What is your database field type and what value do you want to store there (can you provide an example)?
Also what do you want to store - the exact time the record is inserted in the db?

I have tried the following field types date datetime timestamp time and also text

Yes I need it to store the time that the record is inserted.

Ideally I would like to store the date and time yyyy-MM-dd HH:mm:ss

Then you need to use a datetime database field type.
Instead of getting the time on the frontend, use the NOW value on the serverside and format it in the format you need.
NOW will appear in the insert record when you open the data picker.

1 Like

Thanks for the advice I will give it a go.

You should have no issue using the App Connect DateTime to do this. I do it and it works great. Make sure your data field is set to datetime. The reason I do it with the App Connect DateTime feature is we have offices in two time zones and our server is located in a third. Using the App Connect Date Time uses the users date and time where as the NOW value gets the date and time from the server which is useless to us. I also use the exact same formatting that you use (without the seconds).

1 Like

I should have no issue doing this with app connect date time. I’ve tried everything I can think of to get it to work without success I think I will have to go with the server side solution. I can get it to store the date part but not the time. Even when it shows both on the form field.

I was banging my head against a wall trying to do this, @Teodor your suggestion of using NOW on server side worked perfectly for me, thanks for posting!

1 Like

Hi Teodor
I have tried to implement this as you suggested. I have an issue, when I try to update the record(change other fields in the table) Keeping the first date time recorded. the record overwrites and I am left with just the date and a time of 00:00:100:

How do I get around this??

Not sure what you mean can you explain this more detailed, please?
What do you want to happen on update?

I inserted a record with the following fields

date time 1 - this was initially inserted using serverside now method (recorded in this format yyyy-MM-dd HH:mm:ss)
date time 2 - this was left blank

I then needed to update the record
date time 1 (to keep its original time stamp value)
date time 2 add the current time stamp

when I tried to update date time 2 the record for date time 1 records the date but the time is reset to 00:00:00
for example date time 1 - 2020-04-07 16:15:33 becomes 2020-04-07 00:00:00

Why not remove the date1 which you don’t updated from the update record step?
Put there just the date2 and the new NOW value …

I need to keep a record of both times

You said that you want to keep the date1 the same on update.
Then just don’t add it to the update record step! It will keep its value as it was on insert.

Great thats what I needed!!!