Results 1 to 3 of 3

Thread: Date math

  1. #1
    Join Date
    Jan 2009
    Posts
    124

    Unanswered: Date math

    Trying to echo the date for the last day of the month 11 months from now.
    <?PHP echo date('Y/m/d',mktime(1,1,1,$m+12,1,date('Y'))) ?>
    This returns the first of the month 12 months from now but I want the day before.

    <?PHP echo date('Y/m/d',mktime(1,1,1,$m+12,-1,date('Y'))) ?>
    This skips a day!

    Thanks

    Nick

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    consider using the php function dateadd
    PHP: date_add - Manual
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2009
    Posts
    124
    Thanks, very helpful!

    Nick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •