Reputation: 2629
I have a unix timestapm in my database and i want it to be formated like this:
Y-m-dTH:i:s
T is just a symbol between date and time. If I convert it like this:
$t_date=date("Y-m-dTH:i:s", $row['date']);
I get something like this: 2012-03-05UTC06:06:49. The problem is that T is one of the parameters for formating date.
Upvotes: 5
Views: 4195
Reputation: 527378
If you're using PHP 5+, you can just use date("c")
to get an ISO8601-format date (e.g. 2004-02-12T15:19:21+00:00
).
http://us.php.net/manual/en/function.date.php
Upvotes: 1
Reputation: 2234
<?php
echo $t_date=date("Y-m-d\TH:i:s", time());
?>
see http://codepad.org/SOSmzKvS
Upvotes: 8