是否有可能在PHP中获取get和time作为整数。 在php中,我将服务器的日期视为$ todayDate,时间为$ currentTime
$todayDate = date("Y-m-d"); // get current date value
$currentTime = date("h:i:s"); // get current time value
如果当前日期为2017-05-26,则时间为15:20
我需要整数值为201705261520 如果有任何方法请建议。
答案 0 :(得分:3)
你不需要任何新方法,只需你可以做这样的事情
$todaydate=date("Ymdhis");
答案 1 :(得分:1)
只需按照您想要的方式格式化日期
$conn = mysqli_connect('localhost','','');
结果
201705261202
您不需要第二个变种 $todaydate=date("Ymdhi");
echo $todaydate;
?>
答案 2 :(得分:1)
var_dump(date("Ymdhis"));
var_dump(intval(date("Ymdhis")));