Basically in Javascript getFullYear( ) method is used to return the full year based on the local time .Use this method instead of getYear( ) method .
Syntax ->
year.getFullYear(); // None parameter
Return ->
It return an absolute four digit number for example 2015 ,2000
Note -> Use this function ,when a year is compliant years after 2000 .
Example ->
var todaydate = new Date();
var currentyear = today.getFullYear(); // return 16/10/2015
In this Date() object is mandatory ,because it is used to containing current date .
0 Comment(s)