Orbital Clock
Packed Extension (.zip) | Chromium Browsers

otcext.zip

Javascript


var otc_today = new Date();
var otc_day = Math.abs((otc_today - new Date(otc_today.getFullYear(),0,1)) / 86400000);
var otc_year = otc_today.getFullYear()-2000;
if (otc_day < 79) {
var pre_day = otc_day + 287;
var oyf = otc_year - 1;
} else {
var pre_day = otc_day - 78;
var oyf = otc_year;
}
var odf = pre_day.toFixed(1);
var day_dif = Math.abs(365 - odf);
var ddf = day_dif.toFixed(0);
var week_set = odf / 5;
var wf = week_set.toFixed(1);
document.write(odf + " (-" + ddf + ") " + wf + "
4,547,724,0" + oyf);

PHP


// Get DOY OTC
$day = date("z");
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;