Javascript convert yyyy-mm-dd hh:mm:ss like newDate(“day, month date year hh:mm:ss”)
问题 I want to use Date Object Methods ( getHoures(), getSeconds() ...) on new Date("string") (string = month day, year hh:mm:ss ) but my date format is like this : yyyy-mm-dd hh:mm:ss So I need to convert "yyyy-mm-dd hh:mm:ss" to "( "day, month date year hh:mm:ss" )" How can i do please ? Thx ! 回答1: Actually, you don't need to perform any such conversion. The string you have is already in very nearly an acceptable format for new Date(string) and in fact even as is will be accepted by most (if not