You could do this like this ( as it is faster ):

function CreateDate($day, $month, $year) {
    return $year.$month.$day.'000000';
}

CreateDate(04,04,2004) -> 20040404000000

But make sure you add the leading zero to $month and $day ( can
be easily done (number_format for example) )

 -- red

Am Montag, 5. April 2004 13:20 schrieb Andy B:
> if you need to turn the result of mktime() into a valid mysql timestamp
> format then put these 2 lines in your code when needed:
> <?
> //create valid mysql timestamp(14 digit)
> //change to fit your liking
> //sorry turned into a function...
> function CreateDate($day, $month, $year);
> //make sure no arguments were left out
> if!empty($day) && !empty($month) && !empty($year)){
> $time=mktime(0,0,0,'$month','$year');
> //convert to a formated stamp
> $time=date("YmdHis", $time);
> return $time;}
> else{return false;}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to