PDA

View Full Version : How to extract date display?


beginners
08-19-2005, 03:08 AM
Hi

My current date format display from MySQL database extraction is dd/mm
i.e. 18/8, 20/8, 23/8, 3/9, 8/9, 3/10, 9/10, ....

I am wondering if I can change the date format display to be as:

Aug 18, 20, 23
Sept 3, 8
Oct 3, 9

Any help is greatly appreciated.



<span class="content"><b>Show dates:
<?
$query1 = "select DAYOFMONTH(ShowDate) as showday, MONTH(ShowDate) as showmon from Schedule where Timetable = '".$arr["Name"]."' and EndDate = '00000000' and ShowDate >= '".date("Ymd")."') order by ShowDate";
$result1 = mysql_query($query1,$dbConnect);
$comma=0;
while ($rs=mysql_fetch_array($result1)){

print " ".$rs["showday"]."/".$rs["showmon"];
$comma = $comma+1;
if($comma<mysql_num_rows($result1)) echo", ";
else echo".";

}
mysql_free_result($result1);
?>

Brandoe85
08-19-2005, 06:20 AM
Take a look at DATE_FORMAT() (http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html)

Good luck

beginners
08-20-2005, 03:58 AM
[QUOTE=Brandoe85]Take a look at DATE_FORMAT() (http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html)

Had a look but got confused as I am still a newbie to php and mysql. Do you have an example where I can analyse? Appreciate it.

Thanks!