-1

I'm trying to to create a method that returns a random date in that format in the from today to a year ago. So right now I have

var curDate = new Date(),
    oneYearAgo = curDate-365*24*60*60*1000, 
    randDate = new Date(Math.random() * (CurDate - OneYearAgo) + OneYearAgo);

But now how do I convert that to a string like in the title? I'm looking through https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date and can't figure it out because I don't know what the name of that format is.

Subpar Web Dev
  • 3,122
  • 5
  • 19
  • 33

1 Answers1

2

The name of the format is ISO-8601.

Steven Spasbo
  • 627
  • 8
  • 18