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

Convert date

Status
Not open for further replies.

Brianfree

Programmer
Feb 6, 2008
220
GB
Hi, i have a values in a table like...

2009-01-26 14:10:34

Ho can i display it on the screen as 26/01/2009

Also how can i get this into different variables like..

Day = 26
WeekDay = Mon
Month = Jan

Many thanks,

BF
 
Code:
echo date ('j/n/Y', strtodate($originalDate));

Code:
$oD = strtodate($originalDate);
$day = date('j', $oD);
$weekday = date('D', $oD);
$month = date('M', $oD);
 
Hi thanks for the quick reply!

I get the following error when i try to use it..


Fatal error: Call to undefined function strtodate()?

Do i need to declare the function or somthing?

Many thanks..

BF
 
My data in the table is set as a Date_Time field if this helps???

Many thanks

Brian
 
sorry. replace strtodate with strtotime.


typed without engaging brain ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top