mardi 20 octobre 2020

Get random date from the year 2000-2020 in javascript in YYYY-MM-DD

I am trying to get a random date so i can use it in my api url. I need the random date to get random pictures.

I already solved it in python:

start_dt = date.today().replace(year=2000, day=1, month=1).toordinal()
    end_dt = date.today().toordinal()
    random_day = date.fromordinal(random.randint(start_dt, end_dt))
    print(random_day)



Aucun commentaire:

Enregistrer un commentaire