get current year javascript code example

Example 1: Javascript get current year

var currentYear= new Date().getFullYear();

Example 2: get current year php

<?php echo date("Y"); ?>

Example 3: how to get the year in javascript

new Date().getFullYear(); // This will get you the current year

Example 4: how to get current year in nodejs

const todaysDate = new Date()
const currentYear = todaysDate.getFullYear()
// 2020

Example 5: get year from date javascript

document.write(new Date().getFullYear());

Example 6: javascript get current day of month

new Date().getDate();//gets day of month (1-31)