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($_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) $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'))); 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"; } $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('+-','-',('+' . get_timezone_offset($tzidea,'GMT'))); 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 = ( thatdate.getTime() - thisdate.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"; } } $scris=" "; 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=" "; $guts="

Datetime difference supervisor

RJM Programming

June, 2022

Thanks to https://gist.github.com/vtedesco/5671155

" . $results . "
Start Date (YYYYmmdd:HH24MISS)
Time: or :


Time: or :


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