Format date php get with getdate()
<p>I am using the function <code>getdate()</code> to get the date, but I want the minutes, days or whatever to be printed out with two digits. I want to get a message like: <code>[day.month.year][hour:min:sec]</code>.</p>

<p>I've tried it like this:</p>

<pre><code>$today = getdate();
$str = "[" . gmdate("d", $today[mday]) . "." . gmdate("m", $today[mon]) . "." . $today[year] . "][" .  gmdate("H", $today[hours]) . ":" . gmdate("i", $today[minutes]) . ":" . gmdate("s", $today[seconds]) . "]";
</code></pre>

<p>Instead of <code>gmdate</code> I've used <code>date</code>, but I get results like <code>[01.01.2013][00:00:59]</code>. If I check what <code>getdate()</code> returns, everything it's OK.</p>

<p>Is there a way I can format the date as I want and also to get the correct result?</p>
