Form events on implementers interface

I have this form event on a date time field

function(form) {
  var datetime = form.getById(2)
  if (!datetime.getValue()) {
    var m = new Date();
    var dateString = m.getUTCFullYear() + "-" + m.getUTCMonth() + "-" + m.getUTCDate()

This works to set just only the date part but im unable to set the time. I get an error along the lines of format should be YYYY-MM-DD. How do i set value for time?