I think you can simplify this to just set_date_and_time(date_css, datestring, time_css, timestring, key)-- no need for the if/else.