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.
            Asked
            
        
        
            Active
            
        
            Viewed 48 times
        
    -1
            
            
        
        pheromix
        
- 18,213
 - 29
 - 88
 - 158
 
- 
                    2Anything not working with `DateTime::modify`? What have you tried to resolve the problem? Where are you stuck? – Nico Haase Jul 10 '23 at 13:15
 - 
                    1SELECT DATE_ADD('2022-11-25 11:15:49', INTERVAL 2 YEAR) AS future_date; are you want this ? – Bhimani Rutvik Jul 10 '23 at 13:21
 
1 Answers
2
            In PHP (as this was tagged) $date = date('Y-m-d H:i:s', strtotime($row['datefield'] . ' +2 years'));
        timchessish
        
- 136
 - 5