Forums

Date/Time Stamp

ellslist 16 Mar, 2009
I am trying to set up a field in a database table that shows the date and time a user submitted a message. I set up a chronoform that allows users to contact my company and the data from the form posts to a mysql database.

I added a hidden field with a name that matches the the database field name. I then added "date("Y-m-d H:i:s")" in the value field. The code generated is
<input value="date("Y-m-d H:i:s")" id="hidden_7" name="message_sentdate" type="hidden" />. I also tried "<?php echo date("Y-m-d H:i:s") ?>". The former does nothing and the latter returns a parse error when I try to generate the form on the actual website.

I've tried a few variations of the above entries and nothing is working. Thanks for the help.

Brian
GreyHead 16 Mar, 2009
Hi Brian,

ChronoForms does this automatically with a field called 'recordtime', if you let ChronoForms save the data for you it will add this value.

The code used for recordtime is
date("Y-m-d")." - ".date("H:i:s")


Bob
Max_admin 16 Mar, 2009
Hi Brian,

as Bob said, there is a field to hold the date time automatically, however if you are trying your own one then you may try this code:

<?php echo date("Y-m-d")." - ".date("H:i:s"); ?>


Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ellslist 16 Mar, 2009
So there should be a field in the toolbox labeled "recordtime" which can be inserted into the form as a hidden field? If so, I don't see it. Or do I just add "recordtime" to the Form Fields names in the Auto Generated Code tab? Thanks,

Brian
GreyHead 16 Mar, 2009
Hi Brian,

It's added automatically if the field exists in the database table. If you created the table with ChronoForms then it will already be there unless you unchecked the box.

Bob
ellslist 16 Mar, 2009
Nice, just add a database field named "recordtime" and it works perfectly! That is about as simple as it gets...

Thanks for the help.
boogieman 06 Apr, 2009
Hi All,

I used {recordtime} in my email template and i receive the same code {recordtime} in my email instead of the exact time stamp. My form does use the {recordtime} field and it does collect the correct date and time so i know its working. Am i doing something wrong?

~Alex
Max_admin 07 Apr, 2009
Hi Alex,

use this in the email template:

    <?php echo date("Y-m-d")." - ".date("H:i:s"); ?>


Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
boogieman 07 Apr, 2009
I've placed the code in the email template and still i get get a blank when receiving the email. Any other thoughts? :wink:
GreyHead 07 Apr, 2009
Hi boogieman,

[sendfb][/sendfb]
Bob
boogieman 07 Apr, 2009
Hi there,

Attached is a backup of my form. Thanks for your assistance

~Alex
GreyHead 08 Apr, 2009
Hi Alex,

There is no recordtime in this form as far as I can see.

You do have some code to set a Name from Firstname + Lastname. This works OK once you have matched up all the field names correctly. Both field names and PHP variables are case-sensitive: so you have
JRequest::setVar('Name', $Name);
where you need to have
JRequest::setVar('Name', $name);
and you don't have Name in the Dynamic From Name field.

Bob

PS I strongly recommend that you do **not** use the Dynamic From Email field unless you are **absolutely** sure that your ISP supports it and that your admin address will receive email from it. A dynamic From Email makes it highly probable that your emails will be marked as spam.
boogieman 08 Apr, 2009
Hi Bob,

Thanks for your help. I now have everything working except the timestamp. The reason you didn't see the {recordtime} was because i replaced it with this..<?php echo date("Y-m-d")." - ".date("H:i:s"); ?> and that didn't work. I have inserted {recordtime} again in my form and I still see nothing appear in my email! 🙂

~Alex
Max_admin 09 Apr, 2009
Hi Alex,

I'm sure that if you disable the email template editor and add this code, it will show a date/time stamp wherever its in the template:

<?php echo date("Y-m-d")." - ".date("H:i:s"); ?>


show me your template code ? do you have the editor disabled ? it will mess it if its enabled!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 09 Apr, 2009
Hi Alex,

I can't see any code in there to set the timestamp. If you add
<input type='hidden' name='recordtime' value='<?php echo date('Y-m-d H:i:s'); ?>' />
to the end of the Form HTML this works OK. The timestamp is technically when the form page was loaded rather than submitted but I doubt that it will make any difference. You might also need to change the name to avoid problems with storing in the database and turn off the default recordtime field that ChronoForms uses - though again the difference will only be minute or two.

Bob
bartjanssen@mac.com 20 Jul, 2009
Where does the time come from?
My recordtime is about 7 hours off....😶
Any idea?

Thanks
Bart
GreyHead 20 Jul, 2009
Hi Bart,

It's usually the server time. Maybe there's a timezone adjustment needed.

Bob
simunch 10 Aug, 2010
When you say turn your editor off do you mean in Global Settings for the joomla! user that you are logged in as?

Kind Regards,
Si
GreyHead 10 Aug, 2010
Hi Si,

If it's the template editor then you can turn it off in the Email Setup Properties box.

Bob
simunch 11 Aug, 2010
I was logging in here thinking "I bet no-one has answered my question, no-one ever helps me!"

I logged off yesterday and spent quite a while switching off the editor both in joomla Global Settings and User profiles to absolutely no effect. Then I found the setting in Components-Chronoforms-Edit Form-Setup Email-Email Properties-Use Template Editor and was just coming on here to share this solution.

And who is there to destroy both my self pity and pride? Bob! That's who! Thanks a lot Bob.

I have, admittedly, casually and hurriedly evaluted several of the main forms solutions for joomla and believe there may be better solutions for specific specialist requirements however I have to hand it to the Chronoengine team. You have a holistic and quite comprehensive solution that allows folks to rapidly prototype working forms with a minimal level of upfront technical knowledge, learning, effort or funding. There is clear and concise documentation available and a fee free support forum providing a superior level of assistance. Sure it isn't perfect, but on the whole it works and it works really well.

I don't have a great amount of funds to spend and have held off paying the subscription here thinking that maybe there might just be a better use for the money I have available. I have to admit defeat, you win.

Pleased to see you have a book out too, Bob. I will be privately investing in an e-book copy.

I will be taking out a subscription this evening.

Si
GreyHead 11 Aug, 2010
Hi Si,

;-) :-)

Rumours are that the book is due out on Friday . . . but I'm still waiting on final versions of a few chapters so I'll believe it when I see it.

Bob
paulmin 18 Nov, 2010
Hi GreyHead
Where can I change "Y-m-d" to "d-m-Y" in the code to stay permanent?
Thanks, Paul
GreyHead 18 Nov, 2010
Hi Paul,

I'm not sure I understand the question completely. You can change the settings for each from in the form General tab.

Bob
paulmin 19 Nov, 2010
Sorry Bob, I should have elaborated more. I am talking about the "recordtime" field. The time in the database table is displayed in Y-m-d and it is set in the autogenerated code as far as I can see. I can't find any way to change it.
GreyHead 19 Nov, 2010
Hi Paul,

Hmm . . . it would be a deep hack to change that format (it's actually close to the MySQL date-time format and MySQL will happily read it that way). You can either add code to transform the dates on display - I usually do this; or you could add a separate column to store dates in a different format.

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