date('w', timestamp) and
date('w', timestamp) to know the day,
date('n', timestamp) for months, etc.
Now I'm using datetime and I'd like to know what are the equivalent functions to get a day, a month, etc from a datetime.
PS: I know I could use
UNIX_TIMESTAMP() in a SQL query but I prefer avoiding timestamps using in my code.
This question is tagged with
~ Asked on 2011-08-30 17:26:18
Check out the manual: http://www.php.net/manual/en/datetime.format.php
<?php $date = new DateTime('2000-01-01'); echo $date->format('Y-m-d H:i:s'); ?>
~ Answered on 2011-08-30 17:32:09