1

/Date(1482048633480)/ is the result when appending() the DateTime value into HTML.

$("#Date").append($('<div> '+ data.DateTimeFromController+' </div>'))

How to read data.DateTimeFromController in MM/DD/YYYY Hour/Min/Sec AM/PM format?

sav
  • 11
  • 4
  • 1
    http://stackoverflow.com/q/206384/447156 ? – Soner Gönül Dec 18 '16 at 09:32
  • @SonerGönül Almost, but I couldn't find in MM/DD/YYYY Hour/Min/sec AM/PM format. – sav Dec 18 '16 at 09:57
  • You can always format the `DataTime` to a stringi n the controller ( and pass that formatted string ) :) –  Dec 18 '16 at 10:26
  • check out this `var meridiem; var hr; var jsonDate = '1297246301973'; var currentTime = new Date(parseInt(jsonDate)); var month = currentTime.getMonth() + 1; var day = currentTime.getDate(); var year = currentTime.getFullYear(); var hrs = currentTime.getHours(); if( hrs > 12){ hr = hrs - 12; meridiem = 'PM'; } else{ hr = hrs; meridiem = 'AM'; } var min = currentTime.getMinutes(); var sec = currentTime.getSeconds(); var date = day + "/" + month + "/" + year +" " + hr+"/" + min +"/" +sec +" "+meridiem; alert(date);` – Rajput Dec 18 '16 at 12:10

0 Answers0