Re: date problem
| From: | David Freeman | Date: | Sun, 28 Apr 2002 21:43:03 +0000 |
| Subject: | Re: date problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95026@lists.php.net to get a copy of this message | ||
On 28 Apr 2002 at 14:48, Nick Wilson wrote:
> I have a field in MySQL db like this: date TIMESTAMP,
> and it looks pretty regular like this: 20020428011911
If you've got the data in your database then do the date/time
conversions as part of your sql query - it's more efficient.
Something like this would work:
$qid = db_query("SELECT DATE_FORMAT(TimeStamp, '%e %b %y') AS
DispDate FROM sometable");
That will extract your timestamp as DD MMM YYYY from memory - have a
look at the MySQL manual under the chapter on selects and date/time
formatting and you'll get the complete list of '%x' options you can
use.
CYA, Dave