lundi 30 septembre 2019

Generate random date of a particular month in order using python

How to Generate random date of a particular month in this particular format.in order wise i.e., from 1 of month to 30 of that month

2011-08-12T20:17:46.384Z

Tried this but it generates in regular time date format. This code generates randomly but i need the values in order from 1 to 30/31 of that month

from datetime import datetime

d1 = datetime.strptime('1/1/2010 1:30 PM', '%m/%d/%Y %I:%M %p')
d2 = datetime.strptime('1/1/2011 4:50 AM', '%m/%d/%Y %I:%M %p')

print(random_date(d1, d2))



Aucun commentaire:

Enregistrer un commentaire