Re: Reverse of date("w")

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

 



Kevin Murphy wrote:

Not really. If it were always "today" that would work, but in this
case, I was thinking of storing a day of the week in a database
("3"), and then display the info based on that digit. So assuming
that the number was in fact 3, then:

echo date("D","3");

Would return "Wed".

Is there any function like that? Oh, and it has to run on PHP 4.


Any reason you wouldn't write it yourself?

<?php
function getDayFromInteger($integer)
{

   $days = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');

   if (isset($days[$integer]))
   {
      return $days[$integer];
   }

   return false;

}
?>

No reason..... and its what I was planning on. I just was hoping that there was a pre-built function that I was just not seeing. Your solution above is probably the best one. Thanks.

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326

--
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