Welcome Guest, Not a member yet? Register   Sign In
Dates showing up wrong on 31st of the month.
#3

(This post was last modified: 06-01-2017, 10:36 AM by PaulD.)

There was a thing in php where strtotime gives the wrong answer at the end or beginning of months for +1 month and -1 month etc. It was, if I remember correctly, something like on April 30th the first day of the previous month was given as Feb 1, not April 1, because the + or - month functionality had a flaw of some sort in it.

However, I can't remember the exact details as I thought it was fixed in php 5.3+ but your problem really reminds me of that issue. The datetime class is much better, easier and more powerful now anyway. So I would suggest not using strtotime but the datetime class http://php.net/manual/en/class.datetime.php to work out your required months.

Can you show how you are calculating -1 months in php? Might be more revealing.
Reply


Messages In This Thread
RE: Dates showing up wrong on 31st of the month. - by PaulD - 06-01-2017, 10:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB