Reformat code for datetimepicker