Re: convert numerical day of week

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

 



   In that case, one simple way (though not the most economical way, and
really hacky, reinventing the wheel in the process) would be to create a
function like so:

<?
function num2day($num) {
   if($num == "1") {
       $day = "Sunday";
   } elseif($num == "2") {
       $day = "Monday";
   } elseif($num == "3") {
       $day = "Tuesday";
   } elseif($num == "4") {
       $day = "Wednesday";
   } elseif($num == "5") {
       $day = "Thursday";
   } elseif($num == "6") {
       $day = "Friday";
   } elseif($num == "7") {
       $day = "Saturday";
   }
   return $day;
}
?>

On 5/22/07, Bosky, Dave <Dave.Bosky@xxxxxxxxxx> wrote:

 I'm not really sure. I've got a numerical interpretation of the day of
the week in a table and I need to print out what day of the week it
translates to.

I tried using date_format in the MySQL query but it didn't seem to work.




 ------------------------------

*From:* Daniel Brown [mailto:parasane@xxxxxxxxx]
*Sent:* Tuesday, May 22, 2007 12:50 PM
*To:* Bosky, Dave
*Cc:* php-general@xxxxxxxxxxxxx
*Subject:* Re:  convert numerical day of week




    Do you mean by using the date() function?

 On 5/22/07, *Bosky, Dave* <Dave.Bosky@xxxxxxxxxx> wrote:

How can I convert the numerical day of week to the string version?

Example, if the day of the week is 1 I would like to print out 'Sunday'.



Thanks,

Dave




**********************************************************************
HTC Disclaimer:  The information contained in this message may be
privileged and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.  Thank you.
**********************************************************************




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

[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