Creation time saved in database: offset with timezone?

jj135 31 Jul, 2017
Hi!

I have a form that saves data to a database table. I use created:{date:Y-m-d H:i:s} in the field 'Data override on Insert'. This inserts the current date/time in the database table. Works fine, but I was wondering if it is possible to save this date/time in our own timezone?

Kind regards,
Jip
Max_admin 02 Aug, 2017
Answer
1 Likes
Hi Jip,

Its better to save the time in GMT but display it later in whatever timezone you want:
{date.-0500:Y-m-d H:i:s$(data:time)}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jj135 03 Aug, 2017
OK, thanks for this Max.

We store this value in the database (GMT - default) but after this we extract the data to a csv file. In the CSV file I would like to have the 'local' time, so that's the 'display' part of the date. I don't think it is possible to do this in the CSV export settings?

It would be best to actually use the timezone set in Joomla to 'display' the dat in the CSV file. Maybe there would be a way to convert the date between saving it in the database and exporting it to the CSV? But that would make it a quit more complex I guess.

I could also just let the client know he has to be aware the time in the CSV is GMT ;-) It's not a big deal!

Thanks so far!
Max_admin 03 Aug, 2017
Hi Jip,

You can modify the date before the data is added to the CSV using some PHP code, but the better here is to tell the client that dates are in GMT time, maybe they need to import it later into database ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jj135 04 Aug, 2017
I think we'll just leave it as it is and tell the client the have dot the math themselves for now ;-) And indeed, if they ever need to import this in to a database this will keep it GMT.

Thanks Max.
Max_admin 09 Aug, 2017
Hi Jip,

No problems!

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
PaulSandman 06 Oct, 2017
1 Likes
I'm loving your forums! Thank you for all you do. I was trying to time-stamp my email template and from this thread, I came up with this:

Submitted by: <b>{ip:}</b> on <b>{date.-0500:F jS, Y}</b> at <b>{date.-0500:g:ia$(data:time)}</b> EST


This works great for me but I took your code to make it so I wanted to say thank you!


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

VPS & Email Hosting 20% discount
hostinger