hello mark,
you need to use sprintf(), or printf() to achieve what you want.
examples:
$i=98;
printf("%04d","$i");
$date = sprintf ("%04d-%02d-%02d", $year, $month, $day);
echo $date;
the example will echo "0098" and 0000-00-00 on the page.
difference in printf and sprintf is obvious printf echoes the result will the other doesnt.
To add more leading zeroes just change the argument in printf("%0x",$variable)
x=number of zeroes wanted.
you can find out more in the php docs at www.php.net under string functions.
hope this helps!