Forums

Change the format of a date

rbolivar 10 Mar, 2011
Hi all,

I have a form that was created a couple of years ago and there is a DATE field on the form. The client gets a notification email with the date on it. The problem is the date format is dd-mm-yyyy and the client wants mm-dd-yyyy.

What would be the easiest way to change that date format?

The joomla version and the component version havent been updated for a couple of years, do I have to upgrade joomla and/or the component to make this change?

SIte: http://ken-rose.com

This site is on Chrono COntact 3.1.STABLE

Database Version: 4.1.22
Database Collation: utf8_general_ci
PHP Version: 5.2.14
Web Server: Apache/1.3.42 (Unix) mod_auth_tkt/2.1.0 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7m
Web Server to PHP interface: cgi
Joomla! Version: Joomla! 1.5.7 Production/Stable [ Wovusani ] 9-September-2008 23:00 GMT
User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

Thanks for your help,

Rosa
GreyHead 10 Mar, 2011
Hi Rosa,

You can change the format of a date-picker in the Date format box on the Form Editor General tab.

However, if you are saving the data in a database table you may need to think through how to handle the change there.

Bob

PS There is no need to update anything to do this. But the Joomla! version is now around 15 security releases out of date so it would be good practice to update that at least.
rbolivar 11 Mar, 2011
Hi Greyhead,

The forms are saving to a DB, JOS_Chronoforms_Contact table, thats why I am unsure of whats the best way to do this.

The client doesnt need the forms to be saved to a DB, just the email notification.

I dont see any Date format box on the Form Editor General tab.... thats why I was asking if I should upgrade, I guess that date format option is on the newer versions? See attachment...
GreyHead 12 Mar, 2011
Hi Rosa,

Yes, that's CF 3.0 stable (I don't think that there ever was a 3.1 stable).

Hmmm . . . we are three calendars on from that one now :-(

I've dug around a bit and the best I can off is this old post which I think has what you need.

An alternative is to change the format after the form is submitted and before the data is saved to the database table. That's fairly easy to do with a little PHP.

For the saved records, you could run a single query to transform all of the saved date info. Backup first and test several times though.

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