Date format convert javascript

后端 未结 5 1123
再見小時候
再見小時候 2021-01-19 01:01

I am trying to convert \"July 24 2013\" to \"DD-MM-YYYY\" with javascript but I keep getting and error.

I am using new Date(\'July 24 2013\').format(\"DD-MM-YY

5条回答
  •  终归单人心
    2021-01-19 01:21

    There is no Data.prototype.format function in JavaScript.

    You're best off looking at open source options for localizing dates. I've had success with

    • Globalize: https://github.com/jquery/globalize#dates

    There's also:

    • Moment: http://momentjs.com/timezone/
    • DateJS: https://code.google.com/p/datejs/

提交回复
热议问题