Re: Date Formatting in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

Try this one:

<?
function formatDate($val)
{
 setlocale (LC_ALL, '');
 $arr = explode("-", $val);
 return strftime ("%A %e %B %Y", mktime (0, 0, 0, $arr[1], $arr[2],
$arr[0]));
}

echo formatDate($DatePick);
?>

Regards,

Frank
----- Original Message ----- 
From: "David Shugarts" <Azimuth@CompuServe.com>
To: <php-db@lists.php.net>
Sent: Tuesday, June 10, 2003 11:23 PM
Subject:  Date Formatting in PHP


>
>
>
> I have a simple need to reformat a variable coming in as $DatePick,
brought
> forward from a MySQL select in the format:
>
>     2003-11-18
>
> I need to convert it to the format
>
>     November 18, 2003
>
> I am trying to avoid having to mess with the MySQL select statement, as
the
> output is being passed through several documents. So I need to do it
within
> PHP.
>
> I tried making a conversion like
>
>     $DayReport = date ("F d, Y", $DatePick);
>
> But the value of $DayReport is neither correct nor does it change when
> $DatePick changes. For instance, in this example, the $DatePick value of
> "2003-11-18" gets converted to "December 31, 1969."
>
> TIA
>
> Dave Shugarts
>
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux