-1

There is a datetime column in the MySql database, say 2022-11-25 11:15:49. How can I get the date in 2 years after this date ? The times of the future date will be 23:59:59, but the duration is the most important which is 2 years.

pheromix
  • 18,213
  • 29
  • 88
  • 158

1 Answers1

2

In PHP (as this was tagged) $date = date('Y-m-d H:i:s', strtotime($row['datefield'] . ' +2 years'));

See https://www.php.net/manual/en/function.strtotime.php.

timchessish
  • 136
  • 5