Skip to main content

A Random Timestamp Generator

Project description

random_timestamp

A Random Timestamp Generator

Installation

Dependences

* This app only

Installation

*Installation with pip (recommended)*

    *Pip will download and install the package and take care of all the dependences.
    If you havn't pip on your system then install setuptools first after that run "easy_install pip".
    After that you can use pip in your terminal window.*

    * Use the stable release (recommended)::

        pip install random_timestamp

    * With pip you can also uninstall::

        pip uninstall random_timestamp

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


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.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

random_timestamp-1.1-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page