Thanks.  Here's how I did it:
$str = "2003-12-13 12:23:34"
$b = localtime(strtotime($str), 1);
printf("seconds: ".$a["tm_sec"]."\n");

On Sat, 19 Jul 2003, John W. Holmes wrote:

> Date: Sat, 19 Jul 2003 14:28:00 -0400
> From: John W. Holmes <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] MySQL datetime extraction
>
> Yasir Malik wrote:
> > Given a date in MySQL datetime format, how do I extract the elements?
> > That is get the month, day, year, hour, ...
>
> You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.
>
> You can do it in PHP by sending the MySQL timestamp through strtotime()
> and then using date() to extract each component.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> PHP|Architect: A magazine for PHP Professionals – www.phparch.com
>
>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to