Search the Community
Showing results for tags 'combine'.
Say I have the following. record_id | record_name ----------------------------------- 1 one 2 two 3 three 3 three 3 three 4 four 5 five 5 five I want to search through through the table and find all the records. If there are multiple records with same id, I want to combine them into 1 variable and use that. So in the above example, I have 3 threes and 2 fives. I want to combine them so that I only get 1 three and 1 five. How can that be done?
// find the time difference between now and the expiry date $expiry_date = '2017-04-20 09:02:23'; $then = new DateTime($expiry_date); $now = new DateTime(); $remaining_time = $then->diff($now); // I want to add two weeks to the new date. $two_weeks = $now->add(new DateInterval('P2W'))->format('Y-m-d H:i:s'); // new date that combines the remaining time from above and adds 2 weeks to create a new date. This is the issue here. How do I combine these two dates properly? The new date has to be in this format ('Y-m-d H:i:s') $new_date