[JavaScript] Change Date Type Timezone to JST with moment.js

Tadashi Shigeoka ·  Mon, March 3, 2014

I’ll introduce a snippet for changing the timezone of Date type to JST using moment.js, a JavaScript date handling library.

Moment.js

var currentDate = new Date();
var timezone = "Asia/Tokyo";
var currentDateJst = moment(currentDate).tz(timezone).format('YYYY/MM/DD HH:mm:ss');

Reference Information

That’s all from the Gemba.