Orbital Clock
Extension | Chromium Browsers

otcext.zip

Javascript


var otc_now = Date.now();
var otc_get = new Date();
var year = otc_get.getFullYear();
var new_year_gdate = new Date(year, 2, 20, 0, 0, 0);
var set_year = year - 2000;
var final_year = set_year - 1;
var days_total = 365;
if ((year % 4 == 0) && (year % 100 != 0)) {
days_total = 366;
} else if (year % 400 == 0) {
days_total = 366;
}
if (otc_now >= new_year_gdate) {
var next_year = year + 1;
new_year_gdate = new Date(next_year, 2, 20, 0, 0, 0);
final_year = set_year;
if ((next_year % 4 == 0) && (next_year % 100 != 0)) {
days_total = 366;
} else if (next_year % 400 == 0) {
days_total = 366;
}
}
var count_day_dif = new_year_gdate - otc_now;
var days_until = Math.ceil(count_day_dif / 1000 / 60 / 60 / 24);
var days_set = Math.abs(count_day_dif / 1000 / 60 / 60 / 24);
var final_days = days_total - days_set;
final_days = final_days.toFixed(1);
var week_set = final_days / 5;
var final_week = week_set.toFixed(1);
document.write(final_days + ' (-' + days_until + ') ' + final_week + ' 4,547,742,' + final_year + ' OTC');

PHP


// otc doy and year
// vije miller
$year = date("Y");
$set_today = time();
$new_year_gdate = mktime(0, 0, 0, 3, 20, $year);
$set_year = $year - 2000;
$final_year = $set_year - 1;
$days_total = 365;
if((0 == $year % 4) and (0 != $year % 100) or (0 == $year % 400)) {
$days_total = 366;
}
if ($set_today >= $new_year_gdate) {
$next_year = $year + 1;
$new_year_gdate = mktime(0, 0, 0, 3, 20, $next_year);
$final_year = $set_year;
if((0 == $next_year % 4) and (0 != $next_year % 100) or (0 == $next_year % 400)) {
$days_total = 366;
}
}
$count_day_dif = $new_year_gdate - $set_today;
$pre_final = floor($count_day_dif/60/60/24);
$final_day = $days_total - $pre_final;
if ($final_year < 100) {
$zero_year = "0".$final_year;
} else {
$zero_year = $final_year;
}
echo $final_day . " " . $zero_year;

@VijeMiller
(╯°□°)╯︵ ┻┻