将 ACF 时间和日期戳记到 google 日历中

get ACF time and date stamp into google calendar

我正在尝试创建一个 link 以使用日期和时间选择器字段插件从高级自定义字段将日期添加到 google 日历,但我认为我把自己束缚在了结中有了它。

到目前为止,这是我所处的位置

<?php 
$format = "Ymd\THis\Z";
$starttime = get_field('start');
$endtime = get_field('end');
$eventstart = date($format , $starttime);
$eventend = date($format , $endtime);?>

<a href="http://www.google.com/calendar/event?
action=TEMPLATE
&text=[<?php the_title(); ?>]
&dates=[start-custom format='<?php echo $eventstart ;?>']/
[end-custom format='<?php echo $eventend ;?>']
&details=[<?php echo (get_field('summary'));?>]
&location=[address]
&trp=false
&sprop=
&sprop=name:"
target="_blank" rel="nofollow">Add to my calendar</a>

$eventstart$eventend return 似乎是有效格式(分别为 20151231T120000Z 和 20151231T140000Z)但是当 link 进入 google 日历时它只是用 ur

在今天的日期加载 google 日历
    https://calendar.google.com/calendar/render?action=TEMPLATE&text=[test+event]&dates=[start-custom+format%3D%2720151231T120000Z%27]/[end-custom+format%3D%2720151231T140000Z%27]&details=[]&location=[location]&trp=false&sprop&sprop=name:&pli=1&sf=true&output=xml#main_7

谁能告诉我哪里可能出错了?

我真是个白痴!在 link 中编写代码可以正确修复它:

<a href="http://www.google.com/calendar/event?
action=TEMPLATE
&text=<?php the_title(); ?>
&dates=<?php echo $eventstart ;?>/<?php echo $eventend ;?>
&details=<?php echo (get_field('summary'));?>
&location=<?php echo (get_field('address'));?>"
target="_blank" rel="nofollow">Add to my calendar</a>