PHP Date to iCal date format for DTSTART

一个人想着一个人 提交于 2019-12-03 12:20:49
Viktor

There isn't any native PHP function or date format that I'm aware of, so you'll need to create your own function. Something like this:

function getIcalDate($time, $inclTime = true)
{
    return date('Ymd' . ($inclTime ? '\THis' : ''), $time);
}

As hakre pointed out in a comment, the date formatter can't distinguish between a date with time and a date without time - you'll have to decide the logic behind that.

date('Ymd\THis', time())

You can replace time() with your own timestamp.

Astha

This is might be you are looking for link and this also can help you.

mktime function to make timestamp as you want including time or only date to it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!