Re: Reverse of date("w")

From: Date: Tue, 19 Sep 2006 01:55:09 +0000
Subject: Re: Reverse of date("w")
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-241921@lists.php.net to get a copy of this message
Another way to do it would be to store the unix epoch and then just get the weekday name from that? More overhead than Travis's idea, but just as good and you could possibly use the date/time later on. On 9/18/06, Travis Doherty <travis@referable.com> wrote:
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; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#241921) next »