Jump to content

Formating Date


wispas

Recommended Posts

I have attached a file with a date picker script that i ahve been using and working on.

Everything works perfectly the way i want it to work,

 

However when the date is inserted into the text field it comes out as '2011-03-01'

Now.. i need it in this way as i am collecting this information and sending it to my MySQL query, but is there a way i can change it so it visually displays as '1st March 2011', but still go into the database as '2011-03-01' so i can continue to do my query as well as making it visually look good with some sort of JavaScript date formatting.

 

Can anyone please take a look when they have a momemt.

Thanks!

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/231478-formating-date/
Share on other sites

You should post some of the relevant code as I doubt many, if any, people will download your zip.

 

If you are using JQuery there are several existing plugins that should make your life a lot easier. Otherwise you could use a hidden textfield to store the original date format for use in the db and then use something like this to convert that into a more user friendly version.

Link to comment
https://forums.phpfreaks.com/topic/231478-formating-date/#findComment-1191265
Share on other sites

If you use the NoGray Calendar http://www.nogray.com/calendar.php you can set the date_format option to "jS F Y" and leave the server_date_format as the default "Y-n-j" you would get exactly what you need.

 

Disclaimer: I am the developer of the NoGray Calendar

Link to comment
https://forums.phpfreaks.com/topic/231478-formating-date/#findComment-1191404
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.