Format HTTP date message in PHP
<p>Background:</p>

<p>I am building a simple chat program for iOS/Android. On the backend is an equally simple PHP/MySQL server that handles the messages. In some cases messages need to be delayed and not sent immediately. To handle this function I an sending messages via HTTP to a server that schedules when messages will be released. The format that it follows is below: </p>

<pre><code>http://www.company.com:8899/?Env=env&amp;AppName=####&amp;Token=string
&amp;Message=string&amp;ScheduleDate=2010-08-31%2022:10:34%20-0400
&amp;ScheduleAction=action
</code></pre>

<p>The most relevant part of the URL for this question is ScheduleDate which specifies the time/date that the message will be sent</p>

<p>Question:</p>

<p>I am having trouble getting the current date/time, putting it in the required format (YYY-MM-DD HH:MM:SS) and then accounting for the required delay. What I want to do is:</p>

<p>(1) get the current date/time
(2) add 5 minutes
(3) put it back into that URL string</p>

<p>Here is the segment with which I am building the string. I used $roomCreateDate to try and get the current date just to see if I could build the string without accounting for the delay. $comand should build the string to match the format above. </p>

<pre><code>$roomCreateDate = date("Y-m-d H:i:s");

$command =  'localhost:8899/'.
                '?Env='. environment($appversion) .
                '&amp;AppName=EchoFriendly'.
                '&amp;Token=' . $devicetoken .
                '&amp;Message=' . urlencode($apsPayload) .
        '&amp;ScheduleDate=' . urlencode($roomCreateDate) .
        '&amp;ScheduleAction=add';
</code></pre>

<p>Any help is appreciated </p>
