The Date_Time_Group is a combined date/time-stamp used mostly in military. A timestamp looks like this:
101705Bjul09
The format is ddHHMMTmmmyy, where dd = day, mmm = 3-letter month, yy = year, HH = hours (24hrs), MM = minutes and T = timezone.
/** * Returns the Date Time Group * @param int|bool $time UNIX timestamp to encode (false to use current time) * @return string DTG * @link http://de.wikipedia.org/wiki/Date_Time_Group * @link http://en.wikipedia.org/wiki/List_of_military_time_zones */ function getDTG( $time = false ) { if ($time === false) $time = time(); $result = date('dHi', $time); $tz = (date('Z', $time) / 3600) + 12; // zero-indexed $zonecodes = 'YXWVUTSRQPONZABCDEFGHIKLM'; // J = Juliet time, actual time at observer's point // TODO: Exception rule for Y/M time (same timezone, Y=western hemisphere, M=eastern h.) $result .= $zonecodes{$tz}; $result .= strtolower(date('My', $time)); return $result; }
The Hexadecimal_time goes back to the year 1863. It splits the day into 16 hex-hours of 256 hex-minutes with each having 16 hex-seconds. Group separator is an underscore (_) and it is read as a fraction of a day, i.e. you can write 8_00_0 as well as .8000 for noon.
function getHT( $time = false, $formatted = true ) { if ($time === false) $time = time(); $timeOfDay = ( date('U', $time)+date('Z', $time) ) % 86400; // seconds since midnight $hexToD = $timeOfDay*65536/86400; $result = dechex($hexToD); if ($formatted === true) $result = $result{0} . '_' . $result{1} . $result{2} . '_' . $result{3}; return $result; }
date('Z') (to have UTC timestamp), use the stamp non-formatted and print out 0x in front.