Converting the text of a datetime field to another format

Converting the text of a datetime field to another format

I am trying to convert the text of a datetime field from UTC to a more American friendly format. 

I am having trouble getting the text to change to the converted version. I have each input of type=datetime-local assigned to a class dateTime and I am using the function below. 

The code runs without error, but the text of the control is not updated.

Any ideas? Thanks for the help.

  1.     $('.dateTime').click(function() {
  2.         var mainParts = $(this).attr('value').split('T');
  3.         if (mainParts.length > 1)  {
  4.             var dateParts = mainParts[0].split('-');
  5.             var timeParts = mainParts[1].split(':');
  6.             var amPm;            

  7.             if (parseInt(timeParts[0] > 12)) {
  8.                 timeParts[0] = parseInt(timeParts[0]) - 12;
  9.                 amPm = 'PM';
  10.             }
  11.             else
  12.                 amPm = 'AM';            

  13.             $(this).value = dateParts[1] + '/' + dateParts[2] + '/' + dateParts[0] + ' ' + timeParts[0] + ':' + timeParts[1] + ' ' + amPm;
  14.         }
  15.     });