title: PHP get time period by timestamp
body: <p>How can I get the time period (day, week, month) by a given timestamp? I do not want the date. I want the next time period based on the amount of seconds.</p>
  
  <p>Is there a PHP native function for that?</p>
  
  <p>Example: </p>
  
  <p><code>$period = getTimeperiod( 15638400 );</code></p>
  
  <p>My attempt: I could check and count the seconds: </p>
  
  <pre><code>if x &lt;= 60 =&gt; min
  if x &lt;= 60*60 =&gt; hour
  if x &lt;= 60*60*24 =&gt; day
  ...
  </code></pre>
  
  <p>Edit:</p>
  
  <p>Time period means either minute, hour, day, week, ... as stated above... ?! So all I want is the corresponding time period for a timestamp.</p>
  
  <p>Example: (<code>day = 86400 secs</code>) then a timestamp with <code>getTimeperiod( 85000 )</code> should be "day".</p>