Posted By

gdonald on 09/27/06


Tagged

date days ago


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

vali29
kazey
Some0ne


php days ago date


 / Published in: PHP
 

  1. function daysAgo( $days )
  2. {
  3. return date( 'YmdHis', mktime( date( 'H' ),
  4. date( 'i' ),
  5. date( 's' ),
  6. date( 'm' ),
  7. date( 'd' ) - $days,
  8. date( 'Y' ) ) );
  9. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: tylerhall on September 27, 2006

Or perhaps...

function daysAgo($n) { return date("YmdHis", time() - 86400 * $n); }

You need to login to post a comment.