programming-examples/js/Date/Write a JavaScript function to get a full numeric representation of a year (4 digits)..js

9 lines
186 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function full_year(dt)
{
return dt.getFullYear();
}
dt = new Date();
console.log(full_year(dt));
dt = new Date(2015, 10, 1);
console.log(full_year(dt));