Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Birth minus 100 years bug?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39937
    XaviJr
    Participant

    So this is my code:

    $birth = ‘1994-09-18’;
    $birth_minus_100 = date(‘Y-m-d’, strtotime(‘- 100 year’, strtotime($birth)));

    It work fine when I substract 2 years or so, with 100 the result is 1970-01-01. It seems to me some PHP bug no?

    #110428

    A timestamp is the number of seconds elapsed since January, 1st, 1970.
    So any date before then won’t exist (in timestamp terms)

    You should use a different date/time format for going back that far.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.