Re: Formatting date from a database date value

From: Date: Thu, 27 Jul 2000 18:44:25 +0000
Subject: Re: Formatting date from a database date value
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8634@lists.php.net to get a copy of this message
> When I use this command > echo mysql_result($result,$i,received_date); > > the result is 2000-04-27, and what I want it to look like is 04-27-00. > > I had a couple of suggestions that didn't work, we are reading this from > mysql just in case that's a factor. Either use DATE_FORMAT() in your query to format the date or use UNIX_TIMESTAMP to so you can format it using PHP's date() function: $result = mysql_query("SELECT UNIX_TIMESTAMP(DateField) FROM Table"); echo date('m-d-y', mysql_result($result, 0));

« previous php.general (#8634) next »