Format a given date? [SOLVED]
Posted: Tue May 09, 2006 6:03 pm
Is there any easy way to format a given date string? I see that the date() function can format a date, but it expects a timestamp, and I only have the string value pulled from a DB.
When I run date('m/d/Y', "2006-05-09"), it does not recogize the date and instead gives me the Unix epoch (I'm on Linux). This is, however, the way the vast majority of all the dates I'll be dealing with are formatting - they were originally human-friendly (e.g. 5/9/2006), were stuffed into a DB, and are now being pulled out and displayed - so I'm looking for the proper, elegant way to deal with this.
When I run date('m/d/Y', "2006-05-09"), it does not recogize the date and instead gives me the Unix epoch (I'm on Linux). This is, however, the way the vast majority of all the dates I'll be dealing with are formatting - they were originally human-friendly (e.g. 5/9/2006), were stuffed into a DB, and are now being pulled out and displayed - so I'm looking for the proper, elegant way to deal with this.