Is there a way if I pull a date from an Oracle database (mm/dd/yyyy) to get what day of the week that is?
For instance, If I pull back the date of 05/07/2003, is it possible for php to get the week day (which in this case would be a Wednesday) for that date?
Thanks!!
Why would you need to? You can get the current day with:
$day = date(l);
With that, you just have day (number), month (number), year (number). That'd make it quite hard to get the day I think... Can't you just use the above?
No, that's not the way it works here. I have a table with events on it and the event all occur in the future (05/07/2003), but I need to show them on my page today.
$date = getdate (mktime(1,1,1,5, 7, 2003)); $day = $date['wday'];
echo $day;
Which returns 3 which is Wednesday
ok, but If I have 1 row that shows 05/07/2003, the next row has 05/14/2003, the next row has 05/15/2003, etc, how would I do that with your code??
thanks!!
ofcourse..
<? $mytime = "05/07/2003"; $date = getdate (strtotime($mytime)); $day = $date['wday']; echo $day; ?>
run this through a repeatition and change $mytime or subisture it for $row[] etc
Try this:
echo date("l",strtotime($date_from_database));
or if you want the abbreviation, use this:
echo date("D",strtotime($date_from_database));
thanks, that works like a charm.