Skip to content

Instantly share code, notes, and snippets.

@ilius
Created August 23, 2015 07:13
Show Gist options
  • Save ilius/8f1cb053d718358b9cad to your computer and use it in GitHub Desktop.
Save ilius/8f1cb053d718358b9cad to your computer and use it in GitHub Desktop.
<?php
function jmktime($h='',$m='',$s='',$jm='',$jd='',$jy=''){
$h=tr_num($h); $m=tr_num($m); $s=tr_num($s); $jm=tr_num($jm); $jd=tr_num($jd); $jy=tr_num($jy);
if($h=='' and $m=='' and $s=='' and $jm=='' and $jd=='' and $jy==''){
return mktime();
}
list($year,$month,$day)=jalali_to_gregorian($jy,$jm,$jd);
$epoch = mktime($h,$m,$s,$month,$day,$year);
$tz = new DateTimeZone('Asia/Tehran');
$transition = $tz->getTransitions($epoch, $epoch)[0];
$isdst = $transition["isdst"];
$epoch = mktime($h,$m,$s,$month,$day,$year,$isdst);
return $epoch;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment