them damn pesky dates that i hates

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Deddog
Forum Commoner
Posts: 55
Joined: Thu Sep 26, 2002 6:05 am
Location: Brighton

them damn pesky dates that i hates

Post by Deddog »

Trying to display the day of the week for every date record i pull from a table. Have tried all sort's but have ended up with the below examples. The first one is the one i would have my money on, but they both keep giving me thursday!! Any idea's

Code: Select all

<?PHP
//1.
$TheDay      = gmdate("l",$row["BookedDate"] );

//2.
$Break       = '-';  
$DateArray1  = array_reverse(explode('/',$row["BookedDate"]));  
$ReturnDate1 = implode($Break, $DateArray1); 
$TheDay      = gmdate("l",$ReturnDate1);

//3.
$DateArray1  = array(explode('/',$row["BookedDate"]));  
$ReturnDate1 = implode("",$DateArray1); 
$TheDay      = gmdate("l",$ReturnDate1);
mod_edit: added

Code: Select all

tags (and comment signs)[/size]
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

Why don't let the database calculate it for you....

Here are the date and time functions
Deddog
Forum Commoner
Posts: 55
Joined: Thu Sep 26, 2002 6:05 am
Location: Brighton

Oi oi

Post by Deddog »

DAYNAME(b.BookedDate) as TheDay

Many thanks InTer
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

No thnx
Post Reply