sohotcall

Date to timestamp, er, datestamp?

Mar 8th, 2019
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $ymd_to_ts = function($ymd){
  3.     list($y,$m,$d)=explode("-", $ymd);
  4.     return 365 * $y + floor( $y / 4 ) - floor( $y / 100 ) + floor( $y / 400 )
  5.         + 30 * $m + floor( ($m + ( $m > 8 )) / 2) + (($y % 4 == 0) - ($y % 100 == 0) + ($y % 400 == 0) ? 1 : 2) * ($m < 3)
  6.         + $d - 719560;
  7.     };
RAW Paste Data