<?
// idate() for PHP < 5
// Sanity check
if (!is_callable('idate')) {
function idate($char, $ts = false) {
if ($ts === false) {
$ts = time();
} else if (!is_numeric($ts)) {
return false;
}
$char = $char{0};
if ($char == 'B') {
// Swatch time ignores the $ts argument.
return ((int) ((gmdate('U') + 3600) * (1000 / 86400))) % 1000;
} else {
return (int) date($char, $ts); // Drop leading zeroes by casting into an integer.
}
}
}
?>