if you had used the datetimepicker for your input instead of a textbox it would have been easier.