hi,
// Create first part of the order code
$orderNumber = date("Ymd", time());
// Append random number - i assume the -1 is meant to be some random part
$orderNumber .= "-" . uniqid();
this gives u the order number with the date part and an appended id (a little longer than the 1 (13 chars) to guarantee really unique identification.
hth