note 44513 deleted from function.date by aidan

From: Date: Sun, 08 Aug 2004 15:24:11 +0000
Subject: note 44513 deleted from function.date by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74213@lists.php.net to get a copy of this message
Note Submitter: suneel@coolguide.net ---- 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

« previous php.notes (#74213) next »