Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date convert

Status
Not open for further replies.

justride

Programmer
Jan 9, 2004
251
US
my db stores dates as yyyy-mm-dd
my interface in php retrieve them is mm/dd/yyyy

i need to convert both ways, and on the conversion of
$DECORDED = date("Y-m-d", strtotime($DRECORDED));
where $DRECORDED is of mm/dd/yyyy

I am have no luck

if DRECORDED = 8/10/2005

then the conversion results in 2008-10-20 (the right format but wrong numbers)

somehow im not tellin the date function what format my original date is in, any help would be nice

thanks
 
Your code looks fine. There must be something else wrong with the code you haven't shown us.

Ken
 
youre right, i spelled DRECORDED WRONG, look closely, thats the error. thanks for the help though!
 
now what about calling the db and going backwards

i have the mysql format yyyy-mm-dd i want to display with php like
$DATERECORDED = mm/dd/yyyy
and I have
echo date("m/d/Y", strtotime($row['DATERECORDED']))
which isnt working, I get weird dates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top