mysql select and date functions

From: Date: Wed, 19 Feb 2003 00:50:46 +0000
Subject: mysql select and date functions
Groups: php.general 
Request: Send a blank email to php-general+get-136094@lists.php.net to get a copy of this message
i have a field in a table called Posted and it is a timestamp type im using mysql and my page is supposed to take the timestamp field and show it on the screen in the form of month#/dayofmonth/year like 02/18/2003 the problem im having is trying to get it to be formatted.. i tried mysql functions like dayofmonth(Posted) month(Posted) and year(Posted) in the query: $query=mysql_query("select dayofmonth(Posted), month(Posted), year(Posted), hour(Posted), minute(Posted), Name, Prayer from prayer"); this query works just fine but my question is now in php how to display the results for dayofmonth(Posted) and so on further code follows: while($view=mysql_fetch_array($query)) { //display variables from query here... //get to the date functions: //$view[month(Posted)]/... doesnt work //php complains about missing ] and this doesnt work //either while($view=mysql_fetch_object($query)){ //show variables here.. //show date fields in table... //$view->dayofmonth(Posted) doesnt work either all i get //in display is (Posted) ...rest of code here... ?> and its strange because if i try: echo $view->dayofmonth(Posted); i get parse error call to undefined function dayofmonth() in file.php on line (line #) any ideas on how to get this to work? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

« previous php.general (#136094) next »