Page 1 of 1

how to change the date order?

Posted: Tue Dec 28, 2004 3:56 am
by itsmani1

Code: Select all

<?PHP

while ($rowReport = mysql_fetch_object($resReport)) &#123;
	$Rdate =stripslashes($rowReport->appid);
	echo $Rdate;	
?>
$Rdate is returning me date and time like this:
2004-12-21 05:01 -> Year-Month-Day and time
but what i want is: like this
21-12-2004 05:01 -> Day-Month-year
means i want change in order

can any one solve this prob.

Posted: Tue Dec 28, 2004 4:02 am
by bytte
You can use a series of substr() to generate your way of writing down a date.

Posted: Tue Dec 28, 2004 4:37 am
by timvw
as you are using mysql, use the date_format function mysql has...

i believe it's something like (the mysql manual knows better than me, so look it up there to be sure)

Code: Select all

SELECT DATE_FORMAT(somedatecolumn, '%d-%m-%Y %h:%i:%S') AS somedatecolumn