[英]timestamp function Pluse 1 hour PHP
I am tring to get a set time timestamp for eg 我正在尝试获取例如的设置时间时间戳
if I input the follow time 09:00 i want to see the timestamp for today 如果我输入关注时间09:00,我想查看今天的时间戳
function GetTimestamp($time){
date();
}
return GetTimestamp("09:00")
can someone help me please or lead me down the right path 有人可以帮我吗,还是引导我走上正确的道路
You just have to use the strtotime()
function, passing it your time : 您只需要使用strtotime()
函数,将其传递给您的时间即可:
$ts = strtotime('09:00');
var_dump($ts);
And you'll get : 你会得到:
int 1300435200
Note : if you don't specify the date, strtotime
will use today . 注意:如果您不指定日期,则strtotime
将使用今天 。
You could also use the DateTime
class : 您还可以使用DateTime
类:
$dt = new DateTime('09:00');
$ts = $dt->format('U');
var_dump($ts);
使用strtotime
:
$timestamp = strtotime('09:00');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.