This repository has been archived on 2022-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
apiOld/old/time/api.php
2020-12-06 01:05:36 +08:00

22 lines
714 B
PHP

<?php
header("Content-type:text/html;charset=utf-8");
$time=intval(time());
if($_GET['type']==''){
echo $time;
}elseif($_GET['type']=='stamp'){
echo $time;
}elseif($_GET['type']=='date'){
if($_GET['zone']==''){
$time_gap=$time-(60*60*8)+(60*60*0);
}elseif($_GET['zone']<=12 and $_GET['zone']>=-12){
$time_gap=$time-(60*60*8)+(60*60*$_GET['zone']);
}else{
$error=true;
}
header("Content-type:application/json");
if($error==true){
echo '{"error":10004}';
}else{
echo '{"stamp":'.$time.',"year":"'.date("Y",$time_gap).'","month":"'.date("m",$time_gap).'","day":"'.date("d",$time_gap).'","hour":"'.date("H",$time_gap).'","minute":"'.date("i",$time_gap).'","second":"'.date("s",$time_gap).'"}';
}
}