programming-examples/js/Date/Write a JavaScript function to get a two digit representation of a year..js
2019-11-15 12:59:38 +01:00

10 lines
207 B
JavaScript

function sort_year(dt)
{
return ('' + dt.getFullYear()).substr(2);
}
dt = new Date();
console.log(sort_year(dt));
dt = new Date(1989, 10, 1);
console.log(sort_year(dt));