in reply to Using truncate

That's very much not what truncate does. You want substr:
$foo = substr time(), 0, 6;
truncate (read the docs) truncates a *file*, not a string.