我正在创建一个每周工作的表日历.日历看起来像这样
我使用了代码我找到了here来设置我的标题日期.我的代码看起来像这样:
$dt = new DateTime;
$dt->setISODate($dt->format('o'), $dt->format('W'));
$year = $dt->format('o');
$week = $dt->format('W');
$current_time = time();
$return .= '
'.esc_html__('Hours', 'time_reservation').' |
---|
do {
$return .= '
' . $dt->format('l') . '' . $dt->format('d M Y') . '';
$dt->modify('+1 day');
} while ($week == $dt->format('W'));
$return .= '
';for ($hour=8; $hour < 23 ; $hour++) {
$return .= '
';$return .= '
'.$hour.':00';for ($i=0; $i <7 ; $i++) {
$return .= '
';}
$return .= '
';}
$return .= '
';现在,我需要在我的data-reservation_time中输入该格式的Unix格式的日期(这就是为什么有$current_time变量).因此,例如在8:00的星期五20的单元格中,该单元格中应该有1448006400.我稍后会用它来存储在数据库中.
但是我该怎么做?我陷入了困境.任何帮助表示赞赏.
编辑
找到了答案.它在下面:)