Javascript date format like ISO but local

前端 未结 7 1500
广开言路
广开言路 2020-12-11 00:06

how do I format a javascript date like ISO format, but in local time?

with myDate.toISOString() I am getting the time as: \"2012-09-13T19:12:23.826Z\"

7条回答
  •  生来不讨喜
    2020-12-11 00:48

    ISO 8601 is simply a way of formatting dates and can as such can be applied to any time zone.

    Have you tried the timeZone option to the Date object's toLocaleString method?

    This question has answers with examples.

提交回复
热议问题