This is my php class implementation of the terran computational calendar:
example_usage.php
<?php
include_once "TCDate.class.php";
/*
* GET CURRENT DATE and PRINT THE ASSOCIATIVE ARRAY OF THE RESULTING TERRAN CALENDAR DATE:
*/
$terran_date = tcdate();
//prints an associative array
print_r($terran_date);
//print the date in different ways:
echo "\n".tcdateToHTML($terran_date)."\n";
echo $terran_date['padded_date']."\n\n\n";
/*
* CONVERT 2010 UTC WINTER SOLSTICE TO TERRAN CALENDAR DATE
*/
$utc_date = "2010-12-21 23:38:00 UTC";
$delimiter_array = ['-','-',':','--','--',' [a big delimiter] ']; // delimiters in between the units
$old_terran_date = tcdate($utc_date, $delimiter_array);
//prints an associative array
print_r($old_terran_date);
echo "\n".tcdateToHTML($old_terran_date,$delimiter_array)."\n";
if (isset($footer)) echo $footer;
?>
OUTPUT:
Array
(
[year] => 54
[month] => 9
[day] => 9
[hour] => 5
[minute] => 44
[second] => 17
[fraction] => 0
[designator] => TC
[year_base] =>
[offset] => 0
[tc_timestamp] => 1726638282
[unix_timestamp] => 1725774257
[is_leap_second] => 0
[datemod] => 0
[date] => 54.9.9,5.44.17 TC
[padded_date] => 54-09-09 05:44:17 TC
)
54.9.9,5.44.17 TC
54-09-09 05:44:17 TC
Array
(
[year] => 40
[month] => 13
[day] => 1
[hour] => 23
[minute] => 38
[second] => 0
[fraction] => 0
[designator] => TC
[year_base] =>
[offset] => 0
[tc_timestamp] => 1293838704
[unix_timestamp] => 1292974680
[is_leap_second] => 0
[datemod] => 0
[date] => 40.13.1,23.38.0 TC
[padded_date] => 40-13-01 23:38:00 TC
)
40-13-1:23--38--0 [a big delimiter] TC