A Random Timestamp Generator
Project description
random_timestamp
A Random Timestamp Generator
Usage
The function random_timestamp takes four optional arguments:
random_timestamp(year=1900, month=1, day=1, part='DATE/TIME')
If year and month and day are not inputed, the timestamp will be randomly generated between 1900 and today's date (datetime.now().date())).
If a later date after today is inputed, the output date will be today's date as well. The optional part parameter is to select only the date or time portion of the timestamp to output.
>>> from random_timestamp import random_timestamp
>>> random_timestamp()
datetime.datetime(1986, 5, 31, 2, 50, 5)
>>> random_timestamp(2020)
datetime.datetime(2020, 2, 11, 12, 4, 51)
>>> random_timestamp(month=1)
datetime.datetime(1914, 1, 15, 22, 3, 58)
>>> random_timestamp(2020, 4, 16, 'DATE')
datetime.date(2020, 4, 16)
>>> random_timestamp(part='TIME')
datetime.time(10, 59, 6)
License
This project is released under GNU GENERAL PUBLIC LICENSE V3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
random_timestamp-1.0.1.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for random_timestamp-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc48705fa074779aede8b94bc7b6b2b6fbf3deefc0b274512ff371fce090848a |
|
MD5 | 1b12a038ff81b762f5928cd3e44f461f |
|
BLAKE2b-256 | ddf7361c13e73969ecdb92d7c03aed773ff9376b7b4c37a276e7df3d8a66d757 |