<?phpdate_default_timezone_set('Europe/London');$to = '31-05-2016';print(date("Y-m-t 23:59:59", strtotime($to.' -1 months')));
Standard input is empty
2016-05-31 23:59:59
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!