Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

moment js convert to local timezone

// MOMENT.JS IS NO LONGER MAINTAINED - SWITCH TO DAY.JS, LUXON, ETC.

const time = moment.tz("2021-04-14T02:08:10.370Z")
const localtz = moment.tz.guess()
const date = time.clone().tz(localtz)
const formatDate = moment(date).format('MMMM Do YYYY, h:mm:ss A z')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #moment #js #convert #local #timezone
ADD COMMENT
Topic
Name
5+5 =