Jim, Mike :
thanks for reply.
getting desire result with strtotime.

John,
yess u r right.
sometimes in my script date is coming from database. in that case, use of 
DATE_FORMAT() is the best option.

thanks
smita.

>From: "Ford, Mike               [LSS]" <[EMAIL PROTECTED]>
>To: 'Smita Manohar' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: RE: [PHP-DB] question regarding date format
>Date: Mon, 16 Sep 2002 18:40:06 +0100
>
> > -----Original Message-----
> > From: Smita Manohar [mailto:[EMAIL PROTECTED]]
> > Sent: 16 September 2002 18:11
> >
> > hi all,
> > a simple question regarding date, but i stuck with it .
> >
> > havin a variable containing date as,
> > $date_test = "2002-08-02";
> >
> > now i want it should be printed like, August 02, 2002
> > i am doing this with the funcion :
> >
> > echo date("F d, Y", $date_test);
> >
> > but getting a strange result as, January 01, 1970
>
>The date() function takes a timestamp as its second argument, so you have 
>to
>convert your textual date before passing it to date().  With the format you
>have, strtotime should work, so try date("F d, Y", strtotime($date_test))
>
>(P.S. You get January 01, 1970 because PHP converts "2002-08-02" to the
>number 2002 before passing it to date() -- and this represents about 0:33 
>on
>that date!)
>
>Cheers!
>
>Mike
>
>---------------------------------------------------------------------
>Mike Ford,  Electronic Information Services Adviser,
>Learning Support Services, Learning & Information Services,
>JG125, James Graham Building, Leeds Metropolitan University,
>Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
>Email: [EMAIL PROTECTED]
>Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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

Reply via email to