I am trying to generate a timestamp in PHP for use with an API. I cannot seem to get the timestamp to format as it should. The proper format is:
UTC ISO8601 DateTime format: YYYY-MM-DDTHH:MM:SS.mmmmmmmZ
Example: 2013-04-24T11:11:50.2829708Z
Edit, Let me clarify on the actual issue I am having:
The 'Z' Property is returning the timezone offset in seconds. I need the offset returned as date('c') returns it.
Example: +01:00 instead of 3600
Is there a built in function for this in PHP?
You are looking for the
DateTime::format
method in combination with thec
formatter or theDateTime::ISO8601
constant: