3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = strtotime('2014-01-15'); #$date = '2014-01-15'; echo date('Y-m-d',$date).PHP_EOL; $daysbefor1979 = '25568'; $start = strtotime("1900-01-01"); echo $start.PHP_EOL; $diff = ($date - $start); echo $diff.PHP_EOL; $days = ($diff / 86400); echo $days.PHP_EOL; /*echo date('Y-m-d', jdtounix(gregoriantojd(12, 31, 1899) + 41603)).PHP_EOL;*/ $erg = round(($daysbefor1979+$days), 0); echo $erg.PHP_EOL; $days1 = round(($erg-$daysbefor1979), 0); echo $days1.PHP_EOL; $diff1 = ($days1*86400); echo $diff1.PHP_EOL; echo date('Y-m-d',$diff1).PHP_EOL; echo ($diff1+$start).PHP_EOL; echo date('Y-m-d',($diff1+$start)).PHP_EOL; echo PHP_EOL.PHP_EOL; $zahl = $erg; echo date('Y-m-d',((($zahl-daysbefor1979)*86400)+$start));
based on h2bZT
Output for 7.2.0
2014-01-15 -2208989972 3598730372 41651.971898148 67220 41652 3598732800 2084-01-15 1389742828 2014-01-15 Warning: Use of undefined constant daysbefor1979 - assumed 'daysbefor1979' (this will throw an Error in a future version of PHP) in /in/prEEY on line 32 Warning: A non-numeric value encountered in /in/prEEY on line 32 2084-01-16
Output for 7.1.0 - 7.1.10
2014-01-15 -2208989972 3598730372 41651.971898148 67220 41652 3598732800 2084-01-15 1389742828 2014-01-15 Notice: Use of undefined constant daysbefor1979 - assumed 'daysbefor1979' in /in/prEEY on line 32 Warning: A non-numeric value encountered in /in/prEEY on line 32 2084-01-16
Output for 5.5.0 - 7.0.20
2014-01-15 -2208989972 3598730372 41651.971898148 67220 41652 3598732800 2084-01-15 1389742828 2014-01-15 Notice: Use of undefined constant daysbefor1979 - assumed 'daysbefor1979' in /in/prEEY on line 32 2084-01-16