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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello: I am passing a date from

Status
Not open for further replies.

PeterMac

Programmer
Mar 9, 2001
51
0
0
CA
Hello:

I am passing a date from a database to the date function and it returns the wrong month... any ideas why?

saledate is currently: 2003-06-21

and date("F", $row["saledate"])

returns Wednesday, but June 21st is a Saturday... can't figure it out... any help appreciated...

Peter
 
You are correct in that it should return a month... I was playing with the other letter options... and confused myself !!! It was returning December, not June (or Wednesday)... but I did not use the strtotime() function, so I will try that out and let you know what I come up with... thanks for the response anyway...

Peter
 
date() requires that the second parameter be an integer, specifically the Unix Epoch time tick.

strtotime() is useful getting the integer out of the string, but be aware that if the date string passed in is all numeric, "YYYY-MM-DD" is the only format it will parse correctly.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top