Jump to content

Converting the month from yyyy-mm-dd


dadedidhodong

Recommended Posts

I have a php program which accepts the input of the YYYY-MM-DD as the date format and stores it to the database. As soon as the user enters the date with YYYY-MM-DD format (e.g 1990-06-22) how can I convert the 06 (or the MM part) to June as in the 6th month of the year?

Link to comment
https://forums.phpfreaks.com/topic/281358-converting-the-month-from-yyyy-mm-dd/
Share on other sites

Is there a reason why you don't want to store the date as YYYY-MM-DD? That format is more useful for things like sorting.

 

When displaying the data, you could always use MySQL's date_format() function:

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

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.