Timothy Wright wrote:
>... so echo date("Y-n-j") would give me the output in the right format, but
>I need to convert the input to a valid timestamp first.
You can use parse out the year, month and day and then use the mktime function - the
dates
I use are dd/mm/yy format:
/*Make an array of the string TransDate using the / character as the seperator*/
$Date_array = explode("/", $TransDate);
/*If the year is before 60 then assume we are in 2000 - look out in 2061 ! */
If ((int)$Date_array[2] <60) {
$Date_array[2] = "20". $Date_array[2];
} elseif ((int)$Date_array[2] >59 AND (int)$Date_array[2] <100) {
$Date_array[2] = "19". $Date_array[2];
}
/*Make a unix time stamp out of the array elements */
$TransDate = mktime(0,0,0,$Date_array[1],$Date_array[0],$Date_array[2]);
Phil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]