Reputation: 944
I want to convert my date time which is in this format
2015-05-11T18:30:00+05:30
and I want to convert this to timestamp.
I have tried this code
$time = $event->start['dateTime']; // return 2015-05-11T18:30:00+05:30
echo date_timestamp_get($time);
But getting this error
Warning:
date_timestamp_get()
expects parameter 1 to be DateTime
How I can fix this?
Upvotes: 0
Views: 841
Reputation: 59681
First you need to create DateTime
object. Like this:
$time = new DateTime($event->start['dateTime']);
After this since you now use OOP style you probably also want to use OOP style to get your timestamp and so that you don't mix procedural style with OOP style, e.g.
$time->getTimestamp();
See getTimestamp()
for more information and the difference about the procedural style and the OOP style.
Upvotes: 3