Re: function CreateDate i made doesnt work?

From: Date: Tue, 06 Apr 2004 13:31:50 +0000
Subject: Re: function CreateDate i made doesnt work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-182465@lists.php.net to get a copy of this message
Hello Andy, Tuesday, April 6, 2004, 2:18:45 PM, you wrote: AB> i have the function i made: AB> function CreateDate($day, $month, $year) { AB> if(!empty($day) && !empty($month) && !empty($year)){ AB> //convert $day, $month, and $year into a valid timestamp AB> $time= strtotime($day, mktime(0,0,0,$month,1,$year)); AB> $time=date("YmdHis", $time); AB> return $time; } AB> else { AB> return false; }} ?>> AB> my output ends up being Monday January 18, 2038 no matter what i AB> try to use in the forms..... Your function doesn't seem to make any sense to be honest - you're passing in the $day value to strtotime (a function that ideally requires English language date formats) and then asking it to calculate a timestamp based off the offset of the month and year. So ultimately you're feeding strtotime = 10, timestamp which means it's going to try and calculate the difference between 10 and the given timestamp (which is going to be a lot!) What exactly is this function *supposed* to do? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html

« previous php.general (#182465) next »