I want to create a function that will create a random timestamp and cast into a string. Tried a couple ways but not sure if the problem is using python 2.6
Tried this but running into error that says:
TypeError: unsupported operand type(s) for *: 'datetime.timedelta' and 'float'
def gen_datetime(min_year=2018, max_year=datetime.now().year):
start = datetime(min_year, 1, 1, 00, 00, 00)
years = max_year - min_year + 1
end = start + timedelta(days=365 * years)
return start + (end - start) * random.random()
...
randomTime = str(gen_datetime())