#1
  1. Amateur Webdev'er
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    141
    Rep Power
    11

    Number of years passed since date


    I need to know how many October 3rd's have passed since 11-26-12 by math; something dependable and elegant; my brain's busted.

    Anyone?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,005
    Rep Power
    9398
    So the first October 3rd would be 10-03-2013. And you count from there.

    Code:
    $n = YYYY - 2013
    if MM-DD > 10-03 {
        $n++
    }
    PHP Code:
    $n date("Y") - 2013;
    if (
    date("md") > "1003") {
        
    $n++;

    Comments on this post

    • xpatriot agrees

IMN logo majestic logo threadwatch logo seochat tools logo