How to get day, month and year from timestamp in Node.js

1 Answer

0 votes
const timestamp = 1652800307169;

const date = new Date(timestamp);

const year = date.getFullYear();
console.log(year); 

const month = date.getMonth();
console.log(month + 1); 

const day = date.getDate();
console.log(day); 

  
  
  
  
/*
run:
  
2022
5
17
  
*/

 



answered Mar 7, 2022 by avibootz

Related questions

1 answer 159 views
1 answer 181 views
1 answer 143 views
1 answer 194 views
1 answer 159 views
1 answer 149 views
...