Answers for "get current year value in js"

31

Javascript get current year

var currentYear= new Date().getFullYear();
Posted by: Guest on July-25-2019
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