Skip navigation
Currently Being Moderated

creating a slice of "getFullYear()"

Mar 5, 2012 12:10 PM

I am trying to get the date with the first 2 digits removed i.e instead of "2012", I am trying to get "12". I have seen examples using slice and substr but cant seem to get them to work i this instance.

 

Any help would be much appreciated.

 

Below is one of many variations I have tried.

 

 

 

var currentTime = new Date();

var year = currentTime.getFullYear();

year = year.slice(-2);

 

 

alert(year);

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points