Orbital Clock
Packed Extension (.zip) | Chromium Browsers

otcext.zip

Javascript


var greg = new Date();
var greg_set = new Date(greg.getFullYear(), 0, 0);
var greg_diff = (greg - greg_set) + ((greg_set.getTimezoneOffset() - greg.getTimezoneOffset()) * 60 * 1000);
var one_day = 1000 * 60 * 60 * 24;
var greg_day = Math.floor(greg_diff / one_day);
var greg_year = greg.getFullYear()-2000;
if (greg_day < 79) {
var pre_day = greg_day + 287;
var otc_year = greg_year - 1;
} else {
var pre_day = greg_day - 78;
var otc_year = greg_year;
}
var otc_day = Math.ceil(pre_day);
document.write("" + otc_day + " 0" + otc_year + "");

PHP


// Get DOY OTC
$day = date("z") + 1;
if ($day < 79) {
$finalday = $day + 287;
} else if ($day >= 79) {
$finalday = $day - 78;
}

// Get Year OTC
$year = date("Y");
$setyear = $year - 2000;
if ($day < 79) {
$finalyear = $setyear - 1;
} else {
$finalyear = $setyear;
}
$zeroyear = "0".$finalyear;

$senddate = ($finalday." ".$zeroyear);
echo $senddate;