Is there a built-in function that converts a number to the month name?
1 ---> January
2 ---> February
3 ---> March
etc.

Thanks.

    Not that I'm aware of, but I suspect it's pretty easy to make a twelve element array which does the job...

      How about...

      print (date("F", mktime(0,0,0,$month_number,1,2000)));

      The 1 and 2000 are in there just in case the mktime doesn't like a day or year of 0.

      Hank

        thanks.

        both should do the trick. :-)

          Originally posted by gigowiz
          How about...

          print (date("F", mktime(0,0,0,$month_number,1,2000)));

          Because

          $months = array(1=>"January",2=>"February",3=>"March",4=>"April",5=>"May",6=>"June",7=>"July",8=>"August",9=>"September",10=>"October",11=>"November",12=>"December");
          

          is easy enough to stash at the top of your application and will probably run a hundred times faster.

            Originally posted by mrmufin

            Because

            $months = array(1=>"January",2=>"February",3=>"March",4=>"April",5=>"May",6=>"June",7=>"July",8=>"August",9=>"September",10=>"October",11=>"November",12=>"December");
            

            is easy enough to stash at the top of your application and will probably run a hundred times faster. [/B]

            it will be about 0.00001 seconds faster 🙂 seeming as you would have to state all the variables, and buy using "s you would have to parse all that text 😉

              Originally posted by Mega

              it will be about 0.00001 seconds faster seeming as you would have to state all the variables, and buy using "s you would have to parse all that text

              I'll admit that 100 times faster was a bit of an overstatement. But just for amusement, I ran a few tests using the array... and my results showed that the array (even with the slower double-quotes) ran an average of 0.00003 seconds faster than the print(date(mktime())) when run a single time...

              However, when run 6 times, the array() method proved to be .00018 seconds faster, which in the lifecycle of an executing program is an eternity.

                lol

                i duno whether to shoot u or study ya

                🙂

                i have to confess im a freak for having everything as fast as possible.

                i'll never use:

                echo "hi";

                its always echo 'hi';

                  Originally posted by Mega

                  i duno whether to shoot u or study ya

                  Well, if you elect to shoot me, you'd better kill me before you walk away...

                  I've already been studied. The folks who did the studying told me, "it's okay to blame your parents".

                  I was not pleased with their analysis. It was a cop-out, at best.

                    Write a Reply...