title: get month,date, year php time from sql database
body: <pre><code>1398305717 &lt;- my sql database time code like this
  </code></pre>
  
  <p>mysql time row name is <code>time</code></p>
  
  <p>.php</p>
  
  <pre><code>$numMonth = date('m', $time);
  
  $sql = mysql_query("SELECT * FROM videos WHERE date('m',`time`) = $numMonth DESC LIMIT 1");
  $row = mysql_fetch_assoc($sql);
  echo $id = $row['id'];
  </code></pre>
  
  <p>i want to get last id equals to month numer? so i tried to like this.. but not work. how to get it from php. so help me to this post how to get month number from sql.. thanks.</p>
  
  <p>Edit :
  i want like this.. but not work :(</p>
  
  <pre><code>$sql = mysql_query("SELECT * FROM videos WHERE MONTH(FROM_UNIXTIME(`time`)) = '$numMonth' DESC LIMIT 1");
  </code></pre>