0

I've coded a user membership plugin which is supposed to generate a membership expiry date for the member to be 1 year from the date that they sign up. To calculate this date I have the following line of code:

$oneYearOn = date('Y-m-d',strtotime(date('Y-m-d', time()) . ' + 1 year'));

However, in some instances, this seems to be returning a date slightly less than 1 year. For example, we just had a member sign up on 2021-09-27, but the expiry date got set to 2022-09-15. 12 days short of what it should be.

Any ideas why this has happened?

Graphic Detail
  • 101
  • 1
  • 11

0 Answers0