In my PHP code I have an array1 that has 2 columns, i.e.:
ID | startDate
1 | 2012-02-03 11:50
2 | 2012-02-03 11:50
3 | 2012-02-03 11:50
4 | 2012-02-03 11:50
I need to transform array1 into the following array2:
ID | startDate
1 | 2012-02-03 11:50:00
2 | 2012-02-03 11:50:30
3 | 2012-02-03 11:51:00
4 | 2012-02-03 11:51:30
So, I should just increment a time by 30 seconds starting from the second entry. This increment should be cumulatively propagated as you may see in example. I’m not very fluent in PHP. Does anybody know time-related PHP functions that could do this job in few lines of code?
I would look at date() and strtotime()