= 0) { $minis=($hoff % 60); $hris=(($hoff - $minis) / 60); if (($gmtminis + $minis) >= 60) { if (((1 + $hris + $gmthhris) % 24) >= 12) { $thisemojiclass=" nighttime"; } $hris=($hris % 12) + 1; $minis=(($gmtminis + $minis) % 60); } else { if ((($hris + $gmthhris) % 24) >= 12) { $thisemojiclass=" nighttime"; } $minis=($gmtminis + $minis); } $hris=($gmthhris + $hris); if ($hris > 12) { $hris=($hris % 12); } } else { $minis=((0 - $hoff) % 60); $hris=(((0 - $hoff) - $minis) / 60); if (($gmtminis - $minis) < 0) { if (((-1 - $hris + 24 + $gmthhris) % 24) >= 12) { $thisemojiclass=" nighttime"; } $hris=($hris % 12) - 1; if ($hris == 0) $hris=12; $minis=(($gmtminis - $minis) + 60); } else { if ((($gmthhris - $hris + 24) % 24) >= 12) { $thisemojiclass=" nighttime"; } $minis=($gmtminis - $minis); } $hris=($gmthris - $hris); if ($hris < 1) $hris=($hris + 12); } if ($minis > 45 && $hris == 12) { $thisemojicodepoint=128336; } else if ($minis >= 45) { $thisemojicodepoint=128336 + $hris; } else if ($minis <= 15) { $thisemojicodepoint=128335 + $hris; } else { $thisemojicodepoint=128347 + $hris; } $zzb=""; if ($minis < 10) $zzb="0"; if ($thisemojiclass == " nighttime" && $hris < 12) { $lastTime=($hris + 12) . ':' . $zzb . $minis; } else { $lastTime=$hris . ':' . $zzb . $minis; } //echo $thisemojicodepoint; //exit; } else { date_default_timezone_set('Australi' . 'a/Perth'); // YOUR timezone, of the server if ($fromtz == 'UTC') { $date = new DateTime($indate, new DateTimeZone('UTC')); // USER's timezone $date->setTimezone(new DateTimeZone($totz)); } else { //echo $fromtz; //exit; if ($fromtz == 'Australi' . 'a/Perth') { $date = new DateTime($indate); } else { echo '*' . $fromtz . '*'; exit; $date = new DateTime($indate, new DateTimeZone($fromtz)); // USER's timezone } $date->setTimezone(new DateTimeZone('UTC')); if ($totz != 'UTC') { $lastnonutc=$totz; $date = localtimefromtogmt($date, 'UTC', $totz); } else { // 1 o'clock is 🕐 // 2 o'clock is 🕑 // 12 o'clock is 🕛 // 2:30 is 🕝 // 11:30 is 🕦 // 12:30 is 🕧 $gmtdatetimeis=$date->format('D Y-m-d H:i:s') . " GMT at time of first display"; $hrntis=intval($date->format('H')); $gmthhris=$hrntis; $bestemojiclass=""; if ($hrntis >= 12) $bestemojiclass=" nighttime"; $hris=intval($date->format('h')); $minis=intval($date->format('i')); $gmthris=$hris; $gmtminis=$minis; if ($minis > 45 && $hris == 12) { $bestemojicodepoint=128336; } else if ($minis >= 45) { $bestemojicodepoint=128336 + $hris; } else if ($minis <= 15) { $bestemojicodepoint=128335 + $hris; } else { $bestemojicodepoint=128347 + $hris; } $zzb=""; if ($minis < 10) $zzb="0"; if ($bestemojiclass == " nighttime" && $hris < 12) { $lastTime=($hris + 12) . ':' . $zzb . $minis; } else { $lastTime=$hris . ':' . $zzb . $minis; } //echo $bestemojicodepoint; } } } return $date; //->format('Y-m-d H:i:s'); } /** Returns the offset from the origin timezone to the remote timezone, in seconds. * @param $remote_tz; * @param $origin_tz; If null the servers current timezone is used as the origin. * @return int; */ function get_timezone_offset($remote_tz, $origin_tz = null) { // thanks to https://www.php.net/manual/en/function.timezone-offset-get.php if($origin_tz === null) { if(!is_string($origin_tz = date_default_timezone_get())) { return false; // A UTC timestamp was returned -- bail out! } } $origin_dtz = new DateTimeZone($origin_tz); $origin_dt = new DateTime("now", $origin_dtz); if (strpos(str_replace('GMT','/',str_replace('UTC','/',$remote_tz)), '/') === false) { $offset = (trim(str_replace('+','',urldecode($remote_tz))) * 60 * 60); if (strpos(('' . $offset),'-') !== false) { $origin_dt->sub(new DateInterval('PT' . str_replace('-','',('' . $offset)) . 'S')); } else { $origin_dt->add(new DateInterval('PT' . $offset . 'S')); } $rts=$origin_dt->format('Ymd:His'); if (isset($_GET['rightnowstart'])) { echo ""; exit; } if (isset($_GET['rightnowend'])) { echo ""; exit; } } else { $remote_dtz = new DateTimeZone($remote_tz); $remote_dt = new DateTime("now", $remote_dtz); if (strpos($remote_tz, '/Hovd') !== false && strpos($origin_tz, 'GMT') !== false && $offset < 0) { $offset=-$offset; $remote_dt->add(new DateInterval('PT' . ('' . $offset) . 'S')); $remote_dt->add(new DateInterval('PT' . ('' . $offset) . 'S')); } $rts=$remote_dt->format('Ymd:His'); if (isset($_GET['rightnowstart'])) { echo ""; exit; } if (isset($_GET['rightnowend'])) { echo ""; exit; } $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); if (strpos($remote_tz, '/Hovd') !== false && strpos($origin_tz, 'GMT') !== false && $offset < 0) { $offset=-$offset; } } return ($offset / 3600); } if (isset($_GET['rightnowstart'])) { get_timezone_offset(str_replace('+','_',str_replace('%20','_',urldecode($_GET['rightnowstart']))),'GMT'); } else if (isset($_GET['rightnowend'])) { get_timezone_offset(str_replace('+','_',str_replace('%20','_',urldecode($_GET['rightnowend']))),'GMT'); } if (isset($_POST['ichangeable'])) { if ($_POST['smode'] == '0') { //$results='' . $scris . '

Results go below ...
Change in Datetime
' . str_replace('> <', '>+<', str_replace('" "', '"+"', str_replace('+', ' ', urldecode($_POST['pbecomesd'])))) . ''; if ($_POST['sdatestart'] != $_POST['sdateend']) { //2020-04-13T00:00:00.000+08:00) if (strpos(urldecode($_POST['sdatestart']), '/') !== false) { $tzidea=str_replace(' ','_',str_replace('+','_',urldecode($_POST['sdatestart']))); } else { $tzidea=str_replace(' ','+',urldecode($_POST['sdatestart'])); } if (trim($tzidea) == '') { $popstuff.="\n var thisdate=new Date(" . $_POST['yyyydatestart'] . ", " . (-1 + $_POST['mmdatestart']) . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; } else if (strpos(str_replace("GMT","/",$tzidea), '/') !== false) { //$tzidea = str_replace('+-','-',('+' . get_timezone_offset($tzidea,'GMT'))); $tzidea = str_replace('plus','+',str_replace('+','-',str_replace('+-','plus',str_replace('++','-',('+' . get_timezone_offset($tzidea,'GMT')))))); //if (strpos($tzidea, '-') !=== false) { // $tzidea='+' . str_replace('-','',$tzidea); //} else { // $tzidea='-' . str_replace('+','',$tzidea); //} if (strlen(explode('.',$tzidea)[0]) == 2) { $tzidea=substr($tzidea,0,1) . '0' . str_replace('5:00', '5', str_replace('0:00', '0', str_replace('.5',':30',str_replace('.25',':15',str_replace('.75',':45',substr($tzidea,1) . ':00'))))); } if (strpos($tzidea, ":") === false) { $tzidea=str_replace(".5:00", ":30", ($tzidea . ":00")); } $popstuff.="\n var thisdate=new Date('" . $_POST['yyyydatestart'] . "-" . substr(('0' . (0 + $_POST['mmdatestart'])),-2,2) . "-" . $_POST['dddatestart'] . "T" . $_POST['hhdatestart'] . ":" . $_POST['midatestart'] . ":" . $_POST['ssdatestart'] . ".000" . $tzidea . "'); \n"; } else { if (strlen(explode('.',$tzidea)[0]) == 2) { $tzidea=substr(str_replace(' ','+',urldecode($_POST['sdatestart'])),0,1) . '0' . str_replace(':30:00', ':30', str_replace('.5',':30',substr(str_replace(' ','+',urldecode($_POST['sdatestart'])),1) . ':00')); } if (strpos($tzidea, ":") === false) { $tzidea=str_replace(".5:00", ":30", ($tzidea . ":00")); } $popstuff.="\n var thisdate=new Date('" . $_POST['yyyydatestart'] . "-" . substr(('0' . (0 + $_POST['mmdatestart'])),-2,2) . "-" . $_POST['dddatestart'] . "T" . $_POST['hhdatestart'] . ":" . $_POST['midatestart'] . ":" . $_POST['ssdatestart'] . ".000" . $tzidea . "'); \n"; } if (strpos(urldecode($_POST['sdateend']), '/') !== false) { $tzidea=str_replace(' ','_',str_replace('+','_',urldecode($_POST['sdateend']))); } else { $tzidea=str_replace(' ','+',urldecode($_POST['sdateend'])); } if (trim($tzidea) == '') { $popstuff.="\n var thatdate=new Date(" . $_POST['yyyydateend'] . ", " . (-1 + $_POST['mmdateend']) . ", " . $_POST['dddateend'] . ", " . $_POST['hhdateend'] . ", " . $_POST['midateend'] . ", " . $_POST['ssdateend'] . ", 0); \n"; } else if (strpos(str_replace("GMT","/",$tzidea), '/') !== false) { //$tzidea = str_replace('-+','-',str_replace('--','+',('-' . get_timezone_offset($tzidea,'GMT')))); $tzidea = str_replace('plus','+',str_replace('+','-',str_replace('+-','plus',str_replace('++','-',('+' . get_timezone_offset($tzidea,'GMT')))))); //if (strpos($tzidea, '-') !=== false) { // $tzidea='+' . str_replace('-','',$tzidea); //} else { // $tzidea='-' . str_replace('+','',$tzidea); //} if (strlen(explode('.',$tzidea)[0]) == 2) { $tzidea=substr($tzidea,0,1) . '0' . str_replace('5:00', '5', str_replace('0:00', '0', str_replace('.5',':30',str_replace('.25',':15',str_replace('.75',':45',substr($tzidea,1) . ':00'))))); } if (strpos($tzidea, ":") === false) { $tzidea=str_replace(".5:00", ":30", ($tzidea . ":00")); } $popstuff.="\n var thatdate=new Date('" . $_POST['yyyydateend'] . "-" . substr(('0' . (0 + $_POST['mmdateend'])),-2,2) . "-" . $_POST['dddateend'] . "T" . $_POST['hhdateend'] . ":" . $_POST['midateend'] . ":" . $_POST['ssdateend'] . ".000" . $tzidea . "'); \n"; } else { if (strlen(explode('.',$tzidea)[0]) == 2) { $tzidea=substr(str_replace(' ','+',urldecode($_POST['sdateend'])),0,1) . '0' . str_replace(':30:00', ':30', str_replace('.5',':30',substr(str_replace(' ','+',urldecode($_POST['sdateend'])),1) . ':00')); } if (strpos($tzidea, ":") === false) { $tzidea=str_replace(".5:00", ":30", ($tzidea . ":00")); } $popstuff.="\n var thatdate=new Date('" . $_POST['yyyydateend'] . "-" . substr(('0' . (0 + $_POST['mmdateend'])),-2,2) . "-" . $_POST['dddateend'] . "T" . $_POST['hhdateend'] . ":" . $_POST['midateend'] . ":" . $_POST['ssdateend'] . ".000" . $tzidea . "'); \n"; } } else { $popstuff.="\n var thisdate=new Date(" . $_POST['yyyydatestart'] . ", " . (-1 + $_POST['mmdatestart']) . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; $popstuff.="\n var thatdate=new Date(" . $_POST['yyyydateend'] . ", " . (-1 + $_POST['mmdateend']) . ", " . $_POST['dddateend'] . ", " . $_POST['hhdateend'] . ", " . $_POST['midateend'] . ", " . $_POST['ssdateend'] . ", 0); \n"; } $popstuff.="\n var dif = ( thisdate.getTime() - thatdate.getTime() ) / 1000; \n"; $popstuff.="\n if (dif < 0) { dif=-dif; document.getElementById('ssign').value='-'; } else { document.getElementById('ssign').value='+'; } \n"; $popstuff.="\n document.getElementById('ssdateend').title='Seconds'; document.getElementById('ssdateend').value=('0' + eval(dif % 60)).slice(-2); dif-=eval(dif % 60); \n"; $popstuff.="\n document.getElementById('midateend').title='Minutes'; document.getElementById('midateend').value=('0' + Math.floor(eval(eval(dif / 60) % 60))).slice(-2); dif-=eval(Math.floor(eval(eval(dif / 60) % 60)) * 60); \n"; $popstuff.="\n document.getElementById('hhdateend').title='Hours'; document.getElementById('hhdateend').value=('0' + Math.floor(eval(eval(dif / 3600) % 24))).slice(-2); dif-=eval(Math.floor(eval(eval(dif / 3600) % 24)) * 3600); \n"; $popstuff.="\n document.getElementById('dddateend').title='Days'; document.getElementById('odddateend').value=('' + Math.floor(eval(dif / (24 * 3600)))); document.getElementById('odddateend').innerHTML=('' + Math.floor(eval(dif / (24 * 3600)))); document.getElementById('dddateend').value=('' + Math.floor(eval(dif / (24 * 3600)))); \n"; $popstuff.="\n document.getElementById('dateend').value=''; \n"; $popstuff.="\n document.getElementById('yyyydateend').value=''; \n"; $popstuff.="\n document.getElementById('ommdateend').value=''; document.getElementById('ommdateend').innerHTML=''; document.getElementById('mmdateend').value=''; \n"; } else { //$results='' . $scris . '

Results go below ...
End Date (YYYYmmdd:HH24MISS)
' . str_replace('> <', '>+<', str_replace('" "', '"+"', str_replace('+', ' ', urldecode($_POST['pwasd'])))) . ''; $popstuff.="\n var thisdate=new Date(" . $_POST['yyyydatestart'] . ", " . (-1 + $_POST['mmdatestart']) . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; if ($_POST['yyyydateend'] != '0' || $_POST['mmdateend'] != '0') { if (str_replace(' ','+',urldecode($_POST['ssign'])) == '-') { $yr=$_POST['yyyydateend']; $mn=$_POST['mmdateend']; $ms=(-1 + $_POST['mmdatestart']); if ($mn <= $ms) { $mn-=$_POST['mmdateend']; $yr-=$_POST['yyyydateend']; $popstuff.="\n thisdate=new Date(" . $yr . ", " . $mn . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; } else { while ($mn > $ms) { $ms+=12; $yr--; } $mn-=$_POST['mmdateend']; $yr-=$_POST['yyyydateend']; $popstuff.="\n thisdate=new Date(" . $yr . ", " . $mn . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; } } else { $yr=$_POST['yyyydateend']; $mn=$_POST['mmdateend']; $ms=(-1 + $_POST['mmdatestart']); if (($ms + $mn) <= 11) { $mn+=$_POST['mmdateend']; $yr+=$_POST['yyyydateend']; $popstuff.="\n thisdate=new Date(" . $yr . ", " . $mn . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; } else { while (($ms + $mn) > 11) { $ms-=12; $yr++; } $mn+=$_POST['mmdateend']; $yr+=$_POST['yyyydateend']; $popstuff.="\n thisdate=new Date(" . $yr . ", " . $mn . ", " . $_POST['dddatestart'] . ", " . $_POST['hhdatestart'] . ", " . $_POST['midatestart'] . ", " . $_POST['ssdatestart'] . ", 0); \n"; } } } $popstuff.="\n var thedate = new Date(thisdate.getTime() " . str_replace(' ','+',urldecode($_POST['ssign'])) . " ((" . $_POST['dddateend'] . " * 24 * 60 * 60 + " . $_POST['hhdateend'] . " * 60 * 60 + " . $_POST['midateend'] . " * 60 + " . $_POST['ssdateend'] . ") * 1000)); \n"; $popstuff.="\n document.getElementById('yyyydateend').value=thedate.getFullYear(); \n"; $popstuff.="\n document.getElementById('ommdateend').value=('0' + eval(1 + thedate.getMonth())).slice(-2); \n"; $popstuff.="\n document.getElementById('ommdateend').innerHTML=('0' + eval(1 + thedate.getMonth())).slice(-2); \n"; $popstuff.="\n document.getElementById('mmdateend').value=('0' + eval(1 + thedate.getMonth())).slice(-2); \n"; $popstuff.="\n document.getElementById('odddateend').value=('0' + thedate.getDate()).slice(-2); \n"; $popstuff.="\n document.getElementById('odddateend').innerHTML=('0' + thedate.getDate()).slice(-2); \n"; $popstuff.="\n document.getElementById('dddateend').value=('0' + thedate.getDate()).slice(-2); \n"; $popstuff.="\n document.getElementById('ohhdateend').value=('0' + thedate.getHours()).slice(-2); \n"; $popstuff.="\n document.getElementById('ohhdateend').innerHTML=('0' + thedate.getHours()).slice(-2); \n"; $popstuff.="\n document.getElementById('hhdateend').value=('0' + thedate.getHours()).slice(-2); \n"; $popstuff.="\n document.getElementById('omidateend').value=('0' + thedate.getMinutes()).slice(-2); \n"; $popstuff.="\n document.getElementById('omidateend').innerHTML=('0' + thedate.getMinutes()).slice(-2); \n"; $popstuff.="\n document.getElementById('midateend').value=('0' + thedate.getMinutes()).slice(-2); \n"; $popstuff.="\n document.getElementById('ossdateend').value=('0' + thedate.getSeconds()).slice(-2); \n"; $popstuff.="\n document.getElementById('ossdateend').innerHTML=('0' + thedate.getSeconds()).slice(-2); \n"; $popstuff.="\n document.getElementById('ssdateend').value=('0' + thedate.getSeconds()).slice(-2); \n"; $popstuff.="\n document.getElementById('dateend').value=document.getElementById('yyyydateend').value + document.getElementById('mmdateend').value + document.getElementById('dddateend').value + '.' + document.getElementById('hhdateend').value + document.getElementById('midateend').value + document.getElementById('ssdateend').value; \n"; $popstuff.="\n document.getElementById('sdateend').value='" . str_replace('+',' ',urldecode($_POST['sdatestart'])) . "'; \n"; $popstuff.="\n document.getElementById('ssign').value='" . str_replace(' ','+',urldecode($_POST['ssign'])) . "'; \n"; $popstuff.="\n if (document.getElementById('xtime')) { document.getElementById('xtime').innerHTML='' + dowb[eval('' + thedate.getDay())]; } \n"; } } $scris=" Datetime difference supervisor - RJM Programming - June, 2022 "; if (isset($_POST['ichangeable'])) { if ($_POST['smode'] == '0') { $results='' . $scris . '

Results go below ...
Change in Datetime
' . str_replace('>+ + ', '>', str_replace('> <', '>+<', str_replace('" "', '"+"', str_replace('+', ' ', urldecode($_POST['pbecomesd']))))))) . ''; } else { $results='' . $scris . '

Results go below ...
End Date (YYYYmmdd:HH24MISS)
' . str_replace('>+ + ', '>Local', str_replace('> <', '>+<', str_replace('" "', '"+"', str_replace('+', ' ', urldecode($_POST['pwasd']))))))) . ''; } echo $results; exit; } $hguts=" Datetime difference supervisor - RJM Programming - June, 2022 "; $cet=""; $sopt=""; $sstyle=""; $sdata=""; $clobberos=""; $sblur=""; $bsh="setInterval(startb, 1000); "; $sh=""; if (isset($_GET['juststart'])) { $sh=" style='display:none;'"; $bsh=""; $clobberos=" if (1 == 1) { return precos(); } "; $sdata=" title='Newer than is + and older than is - and [Exact] is neither' data-"; $sopt=""; $cet=" contenteditable=true onblur=precos(); "; $sstyle=" style=background-color:orange; "; //$sblur=' onchange="setTimeout(precos,1000);" '; } $guts=" Datetime difference supervisor

RJM Programming

June, 2022 Thanks to https://gist.github.com/vtedesco/5671155
" . $results . "
: or :



: or :



"; echo "" . $hguts . " " . $guts . "
"; ?>