Re: Date problem

From: Date: Wed, 09 Apr 2003 19:47:58 +0000
Subject: Re: Date problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-143173@lists.php.net to get a copy of this message
"Shaun" <shaun@mania.plus.com> wrote in message news:20030409175747.25163.qmail@pb1.pair.com... > > > reult of a query, but it always prints April, any ideas? > > > > > > settype($month_result, integer); > > > $month_result = mysql_result($result, $l, Booking_Date); Booking_Date is a define() that you've setup to index the field in your table? > > > $month = date(F, strtotime($month_result)); > > > > First, "I am a string" so quote your strings. Second, > > tell the list what this prints: Good advice there. Did you take it? ($month = date("F"...etc. > > > > print $month_result; > > Regards, > > Philip > > month_result = 4 > month = April > month_result = 5 > month = April > etc So you're not storing dates in your table, you're just storing a month number. The strtotime function needs more information than just a numerical month to create a valid timestamp for you. Try this: $ntime = mktime(0, 0, 0, $month_result, 1, 2000); // year is irrelevant. echo date("F", $ntime); -- Rob

« previous php.general (#143173) next »