如何将此代码运行到 PHP 5.1.6
$obj['timezone'] = IssetPost('tz');
$tz = new DateTimeZone($obj['timezone']);
$date = new DateTime('NOW');
$date->setTimeZone($tz);
$currentDate = $date->format('m j Y H i');
$datePart = explode(" ",$currentDate);
我正在重写它,到目前为止我的代码是:
$obj['timezone'] = IssetPost('tz');
$tz = date_default_timezone_set($obj['timezone']);
$date = date('NOW');
$date = date_default_timezone_get($tz);
$currentDate = $date->format('m j Y H i');
$datePart = explode(" ",$currentDate);
我收到此错误
PHP致命错误:在第27行的/var/www/users/sys3/htdocs_ssl/pc/cid/conference_schedule.php中调用非对象的成员函数format()
谢谢
答案 0 :(得分:0)
$currentDate = date('m j Y H i')
返回给定时间戳的格式化日期字符串,即#34;现在"默认情况下。只需写下https://mydomainname.com
。