How can I convert an integer into a date format like 2012-12-12 for insertion in an XML document?
<Feed>
<order>
<Order>
<orderid>71</orderid>
<login>krishna</login>
<date>1123213230</date>
I’ve used the below code:
$_xml .= "\t<date>" . $n['date'] . "</date>\r\n";
You can use
FROM_UNIXTIME(column_name, '%Y-%m-%d')in your MySQL query.Or you can just use
date('Y-m-d', $n['date']).Also, you can use
PHP_EOLand you won’t have to manually add"\r\n"to the end of your strings.