jeudi 23 février 2017

Generate Random Timestamp in a given range?

I'm trying to do something like:

start=input("select starting date, format example : Jan 01 00:00:00")
end=input("select ending date")

if start>end:
     start,end=end,start

print(randomize_time(start,end))

output: Aug 05 13:15:59

I have tried using random.randint, but if I select a range like: 00:00:00 && 01:00:00, the only part that is randomized is the hour, minutes and seconds will be ignored (since I'm doing random.randint(0,0)).

How would I do that properly?

Thanks in advance SO!

Windir




Aucun commentaire:

Enregistrer un commentaire