fil79 Posted August 20, 2013 at 05:07 PM Report #522196 Posted August 20, 2013 at 05:07 PM Boas tenho um array que contem varias datas. Como posso ir buscar a data minima ou máxima contida nesse array? Desde já agradeço MCITP-MCTS-MCP
KiNgPiTo Posted August 20, 2013 at 05:19 PM Report #522199 Posted August 20, 2013 at 05:19 PM Como é que tens guardadas as datas no array?
fil79 Posted August 20, 2013 at 05:23 PM Author Report #522201 Posted August 20, 2013 at 05:23 PM $datesRecorded=array('2012-12-10','2012-12-20'); MCITP-MCTS-MCP
KiNgPiTo Posted August 20, 2013 at 05:28 PM Report #522203 Posted August 20, 2013 at 05:28 PM (edited) As funções max/min funcionam para arrays do tipo time, tens é de passar todos os valores para time: $datesRecorded=array('2012-12-10','2012-12-20'); $tdate = array_map('strtotime', $datesRecorded); $max = max($tdate); $min = min($tdate); echo date('Y-m-j', $max); echo date('Y-m-j', $min); Edited August 20, 2013 at 05:29 PM by KiNgPiTo
fil79 Posted August 21, 2013 at 03:33 PM Author Report #522276 Posted August 21, 2013 at 03:33 PM obrigado MCITP-MCTS-MCP
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now