Skip to main content

If you pass the timestamp as the parameter to moment(), what I do is: moment() (e.g if the timezone is Asia/Hong_kong which is +08:00)

const localDateTime = moment((item.createdAt.seconds + 8 * 3600) * 1000).format('YYYY-MM-DD HH:mm, what I do is:ss');

const localDateTime = moment((item.createdAt.seconds + 8 * 3600) * 1000).format('YYYY-MM-DD HH:mm:ss'); 

If you pass the timestamp as the parameter to moment(), what I do is: (e.g if the timezone is Asia/Hong_kong which is +08:00)

const localDateTime = moment((item.createdAt.seconds + 8 * 3600) * 1000).format('YYYY-MM-DD HH:mm:ss');

If you pass the timestamp as the parameter to moment() (e.g if the timezone is Asia/Hong_kong which is +08:00), what I do is:

const localDateTime = moment((item.createdAt.seconds + 8 * 3600) * 1000).format('YYYY-MM-DD HH:mm:ss'); 
Source Link
Cody Ng
  • 339
  • 1
  • 5
  • 15

If you pass the timestamp as the parameter to moment(), what I do is: (e.g if the timezone is Asia/Hong_kong which is +08:00)

const localDateTime = moment((item.createdAt.seconds + 8 * 3600) * 1000).format('YYYY-MM-DD HH:mm:ss');