note 44513 added to function.date
| From: | suneel at coolguide dot net | Date: | Sun, 08 Aug 2004 15:03:52 +0000 |
| Subject: | note 44513 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74212@lists.php.net to get a copy of this message | ||
Way to find a weekday from a date & time value
Assuming you want weekday...
A crude yet sophisticated way.
//hold your date & time in a string
$dtime='2004-04-02 12:59:39';
//now trim any leading & trailing spaces
$dtime=trim($dtime);
//seperate the date & time based on space in between
list($date,$time)=explode('',$dtime);
//Now get the peices of date for timestamp generation
list($year,$month,$day)=explode('-',$date);
//now make a timestamp
$stamp=mktime (0,0,0,$month,$day,$year);
//now get the week day in full format like 'Saturday..', you want from the stamp and
date() function. use 'D' as parameter to date() function if you want short 3 letter style
weekdays.
$wday=date('l',$stamp);
Thanks,
Suneel Kanuri,
http://jmanage.coolguide.net
http://rina.coolguide.net
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44513
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44513&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44513&report=yes
Search -- http://master.php.net/manage/user-notes.php