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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.