Re: convert w date to l format

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

 



Steven Macintyre wrote:
Um ... can anyone point me to somewhere that it explains this ...

I am trying to convert a "int" (1 through 7) to a day name (Monday through
Friday) while in a loop with mysql results

What happened to the weekend? I'd hate to lose the weekend!!

I have tried $day = date('w', $day);
But this does not seem to work ... can anyone assist?

That's because the date function expects a timestamp.

What you want is an array, nothing more complicated than that.

$days = array(1 => 'Monday',
              2 => 'Tuesday',
              3 => 'Wednesday',
              4 => 'Thursday',
              5 => 'Friday',
              6 => 'Saturday',
              7 => 'Sunday');

$day = $days[$day];

-Stut

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux