javascript user value convert to format [duplicate]
问题 This question already has answers here : How to convert 12-Jan-2016 like date string in javascript to 2016-01-12 00:00:00 (3 answers) Closed 3 years ago . var t = "Jan. 20, 2017 20:28:53" var s = t.format("%m/%d/%Y %H:%M:%S"); alert(s); How I convert the value into the 01/20/2017 20:28:53 this format.Please help me. Thank you... 回答1: Try the moment library http://momentjs.com/ You can do moment('Jan. 20, 2017 20:28:53').format('MM/DD/YYYY HH:mm:ss') returns -> '01/20/2017 20:28:53 PM' 回答2: