0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

Organization

【JS】moment.jsでナノ秒を日付に整形する

ナノ秒(nanosecond)をフォーマットするには1000を掛ければ問題ない。

var nanosecond = "1565980455";

console.log(moment(nanosecond*1000).format()); //2019-08-17T03:34:15+09:00

console.log(moment(nanosecond*1000).format('YYYY/MM/DD')); //2019/08/17
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What are the problem?