I've got an开发者_如何学Python arry with dates.
print_r ($date[$i]);
will output sth. like: 2011-06-16
Is it possible to create an output like: 16.6.2011 ? How would I do that? have you got a reference?
<?
echo date('d.m.Y', strtotime( $date[$i] ) );
?>
you should find that this page has all the answers for you
http://php.net/manual/en/function.date.php
You can use the date function to print it, using the strtotime function to first convert it to a Unix timestamp. Or you can use the DateTime functions like:
date_create($date[$i])->format('d.n.Y');
If you don't want leading 0's on your day, then you should use:
date_create($date[$i])->format('j.n.Y');
use the php date() function
you can see a documentation about it here
http://php.net/manual/en/function.date.php
You don't really have a date, but a string. Either manipulate the string with the string manipulation functions, or parse and re-format the date string with the date functions.
date('d.n.Y', strtotime($date[$i]));
There is a reference when you search in Google for "date" ;)
精彩评论