HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/public_html/archive/demo/functions/_datetime.php
<?php

define("DST",date(I));

function date_caltounix($date) {
	$yyyy = substr($date,6,4);
	$mm = substr($date,0,2);
	$dd = substr($date,3,2);
	$hour = date("H");
	$min = date("i");
	$sec = date("s");
	return mktime($hour,$min,$sec,$mm,$dd,$yyyy);
}

function date_unixnow($date) {
	$date = (string)$date;
	if (strlen($date) == 14) {
		$unix = date_tstounix($date);
	} else $unix = (int)$date;
	
	$unix += (TIME_ADJUST * 3600) + (DST * -3600);
	
	return $unix;
}

function getdate2($ts) {
	$d = getdate($ts);
	if ($d[hours] < 12) { $d[ampm] = "am"; }
	if ($d[hours] > 12) { $d[hours] -= 12; $d[ampm] = "pm"; }
	if ($d[hours] == 12) { $d[ampm] = "pm"; }
	if ($d[hours] == 0) { $d[hours] = 12; $d[ampm] = "am"; }
	if ($d[hours] < 10) $d[hours] = "0".$d[hours];
	if ($d[minutes] < 10) $d[minutes] = "0".$d[minutes];
	if ($d[mon] < 10) $d[mon] = "0".$d[mon];
	if ($d[mday] < 10) $d[mday] = "0".$d[mday];
	return $d;
}

function now() {
	return date("YmdHis");
}

function date_ext($ts) {
	$ts = date_unixnow($ts);
	$d = getdate2($ts);
	return $d[weekday].", ".$d[month]." ".$d[mday].", ".$d[year]." ".$d[hours].":".$d[minutes]." ".$d[ampm];
}

function date_ext_notime($ts) {
	$ts = date_unixnow($ts);	
	$d = getdate2($ts);
	return $d[weekday].", ".$d[month]." ".$d[mday].", ".$d[year];
}

function date_ext_abbr($ts) {
	$ts = date_unixnow($ts);	
	$d = getdate2($ts);
	return $d[month]." ".$d[mday].", ".$d[year]." ".$d[hours].":".$d[minutes]." ".$d[ampm];
}

function date_gregoriantots($greg) {
	$d = explode("/",$greg);
	if ($d[0] < 10) $d[0] = "0".$d[0];
	if ($d[1] < 10) $d[1] = "0".$d[1];
	return $d[2].$d[0].$d[1]."000001";
}

function date_long($ts) {
	$ts = date_unixnow($ts);
	$d = getdate2($ts);
	return $d[month]." ".$d[mday].", ".$d[year];
}

function date_std($ts) {
	$ts = date_unixnow($ts);
	$d = getdate2($ts);
	return $d[mon]."/".$d[mday]."/".$d[year];
}

function date_short($ts) {
	$ts = date_unixnow($ts);
	$d = getdate2($ts);
	return $d[mon]."/".$d[mday];
}

function date_time($ts) {
	$ts = date_unixnow($ts);
	$d = getdate2($ts);
	return $d[hours].":".$d[minutes]." ".$d[ampm];
}

function date_tstounix($ts) {
	while (strlen($ts) < 14) $ts .= "0";
	
	$yr = substr($ts,0,4);
	$mon = ((int)substr($ts,4,2)<10?substr($ts,5,1):substr($ts,4,2));
	$day = ((int)substr($ts,6,2)<10?substr($ts,7,1):substr($ts,6,2));
	$hr = ((int)substr($ts,8,2)<10?substr($ts,9,1):substr($ts,8,2));
	$min = ((int)substr($ts,10,2)<10?substr($ts,11,1):substr($ts,10,2));
	$sec = ((int)substr($ts,12,2)<10?substr($ts,13,1):substr($ts,12,2));
	return mktime($hr,$min,$sec,$mon,$day,$yr);
}

function date_unixtots($unix) {
	return date("YmdHis",$unix);
}

?>