Trevor:

    I prefer  date( '(T) d-M-y h:ia +Z"' );

    Regards.
---
José Enrique
http://jese.alcorce.org
---
"Trevor Gryffyn" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]
I know a lot of people will recommend using strtotime() to convert it to
a unix timestamp, then use date() to format that:

Date("m/d/Y",strtotime("Sep 12 2004 2:16AM"))

That may work..   I have an inherent distrust of functions that use too
much logic that isn't apparent to me, so I don't use strtotime() hoping
to avoid it misinterpreting the date/time string I'm giving it.  I
prefer full control.

I'd do it the hard way just to have confidence in the results (there's
probably a better "hard way" as well, but here's the quick and dirty):


<?php
$months =
array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Au
g"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);

$origdate = "Sep 12 2004 2:16AM";

List($textmonth,$day,$year,$time) = explode(" ",$origdate);

$newdate = Date("m/d/Y",mktime(0,0,0,$months[$textmonth],$day,$year);

?>

But that's just one way to skin this cat.

-TG

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 22, 2004 9:13 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Date Formatting
>
>
>
> I see in the manual about how to format the current date
> using the date()
> function...but my question is...I have the date in this format:
> Sep 12 2004  2:16AM
>
> And I needed it formatted as:
> 09/12/2004  (I don't need the time)
>
> How do I go about doing that?
>
> Thanks,
> Ron
>
>
>
>
>
> 

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

Reply via email to