Which type of date field should I use?
Posted: Sun Jun 01, 2003 5:50 pm
I'm have a dilemma...
I'd like to store dates in MySQL as YYYY-MM-DD, so that when I transfer dates from my access database, they will convert smoothly.
The problem is that I can't seem to find a way to display the date as MM-DD-YYYY, when I pull them from the MySQL database as YYYY-MM-DD.
I know that I could save each piece of the date into 2 or 3 text parts and switch the order that I print them. But, there's gotta be an easier way.
Is using a timestamp the only way that you can "work" with a date (not just use it as text)?
Let's say I have a date as:
$CurrentDate = date('Y-m-d'); // YYYY-MM-DD
How do I now take $CurrentDate and make it display in the MM-DD-YYYY format?
I'd like to store dates in MySQL as YYYY-MM-DD, so that when I transfer dates from my access database, they will convert smoothly.
The problem is that I can't seem to find a way to display the date as MM-DD-YYYY, when I pull them from the MySQL database as YYYY-MM-DD.
I know that I could save each piece of the date into 2 or 3 text parts and switch the order that I print them. But, there's gotta be an easier way.
Is using a timestamp the only way that you can "work" with a date (not just use it as text)?
Let's say I have a date as:
$CurrentDate = date('Y-m-d'); // YYYY-MM-DD
How do I now take $CurrentDate and make it display in the MM-DD-YYYY format?