Re: Date formatting in PHP 3.0

From: Date: Thu, 30 Aug 2001 16:32:55 +0000
Subject: Re: Date formatting in PHP 3.0
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65327@lists.php.net to get a copy of this message
<Original message> From: Paul McGee <pmcgee@inprise.com> Date: Thu, Aug 30, 2001 at 12:13:21PM -0400 Message-ID: <20010830170839.89933.qmail@pb1.pair.com> Subject: [PHP] Date formatting in PHP 3.0 > I'm looping through a MSQL db pulling out the dates where I would like to > display the date and then the day of the week. The problem is that every > date returns the same day of the week, Wed. I checked the documentation and > it doesn't say anything about the expression only being executed once during > inside the WHILE loop. > > I've tried: > > $m = substr($row[0],0,4); > $d = substr($row[0],5,2); > $y = substr($row[0],8,2); > $dy = date ("D", mktime(0,0,0,$m,$d,$y)); > > and just using the date field > > $dy = date ("D", $row[0]); > > Any help would be greatly appreciated! </Original message> <Reply> Did you give a look at your own code? A month consisting of 4 digits? And a year consisting of 2 digits? I'd say: --- PHP code --- $y = substr($row[0],0,4); $m = substr($row[0],5,2); $d = substr($row[0],8,2); $dy = date ("D", mktime(0,0,0,$m,$d,$y)); and just using the date field $dy = date ("D", $row[0]); --- End of PHP code --- </Reply> -- * R&zE: </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#65327) next »