5

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.

0

2 Answers 2

8
<?php

echo $t_date=date("Y-m-d\TH:i:s", time());

?>

see http://codepad.org/SOSmzKvS

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.