title: Get the Year/Month/Day from a datetime in php?
body: <p>I used <code>date('w', timestamp)</code> and <code>date('w', timestamp)</code> to know the day, <code>date('n', timestamp)</code> for months, etc.</p>
  
  <p>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.</p>
  
  <p>PS: I know I could use <code>UNIX_TIMESTAMP()</code> in a SQL query but I prefer avoiding timestamps using in my code.</p>