Jump to content

Converting Date Format (08/12/11 to August 12)


sintax63

Recommended Posts

I have two fields in my table called start_date and end_date. The date format for each is xx/xx/xx.

 

I know how to do something like:

if ($start_date_month == "8") { $start_month = "August"; }

 

So I can change the 1 or 2 digit months to names. What I'm not sure how to do is strip out both the month and day from the full xx/xx/xx format.

 

Any help would be much appreciated.

 

Thanks!

If you had stored the values in the proper DATE or DATETIME type field, this would be very easy. I hope it isn't too late to change them to the right format.

 

I wish it was possible. This is how I store dates / date time in my personal coding but I'm getting these values from a CSV file that I'm importing into phpMyAdmin.

If you had stored the values in the proper DATE or DATETIME type field, this would be very easy. I hope it isn't too late to change them to the right format.

 

I wish it was possible. This is how I store dates / date time in my personal coding but I'm getting these values from a CSV file that I'm importing into phpMyAdmin.

So, convert the values to proper dates when putting them in the database instead of storing them as strings. Perhaps you are too young to remember the significance of Y2K

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.