Answers for "new date just year js"

8

how to get the year in javascript

new Date().getFullYear(); // This will get you the current year
Posted by: Guest on April-21-2020
1

javascript get day of year from date

//Month -> 0= Jan, 11=Dec | myDate = 6 Dec 2019 10:45
var myDate = new Date(2019, 11, 06, 10, 45);
var dayInYear = Math.floor((myDate - new Date(myDate.getFullYear(), 0, 0)) / (1000 * 60 * 60 * 24));
Posted by: Guest on September-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language