Convert date to another timezone in JavaScript

后端 未结 24 3947
没有蜡笔的小新
没有蜡笔的小新 2020-11-21 04:45

I am looking for a function to convert date in one timezone to another.

It need two parameters,

  • date (in format \"2012/04/10 10:10:30 +0000\")
24条回答
  •  清歌不尽
    2020-11-21 05:32

    You can also use https://www.npmjs.com/package/ctoc_timezone

    It has got much simple implementation and format customisation.

    Changing format in toTimeZone:

    CtoC.toTimeZone(new Date(),"EST","Do MMM YYYY hh:mm:ss #{EST}");

    Output :

    28th Feb 2013 19:00:00 EST

    You can explore multiple functionalities in the doc.

提交回复
热议问题