Skip to main content

Generate random time stamps

Project description

randomtimestamp

Random timestamp generator

Usage

randomtimestamp can be used from the command line or imported as a python package.

Command line usage

To use the script from command line

  $randomtimestamp
  30-08-1995 17:58:14

Python Package Usage

The function randomtimestamp takes two optional arguments:

randomtimestamp(start_year=1950,text=True)

The default values of start_year and text are 1950 and True respectively. The timestamp is generated between 1950 and current year (datetime.now().year). Although a year before 1950 could have been used, but it didn't seem to be necessary.

By default, the function returns the output as string in format (DD-MM-YYYY HH:MM:SS), where HH is in 24-hour format. Setting text=False returns a datetime object.

Here are examples of all the possible syntaxes:

  >>>from randomtimestamp import randomtimestamp

  >>>randomtimestamp()
  '02-06-1970 23:34:10'

  >>>randomtimestamp(2010)
  '02-06-2013 23:34:10'  

  >>>randomtimestamp(start_year=2005)
  '10-04-2015 10:55:02'  

  >>>randomtimestamp(2010,False)
  datetime.datetime(2010, 5, 16, 3, 32, 18)

  >>>randomtimestamp(text=False)
  datetime.datetime(1951, 2, 13, 18, 19, 1)

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

randomtimestamp-1.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

randomtimestamp-1.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file randomtimestamp-1.0.0.tar.gz.

File metadata

  • Download URL: randomtimestamp-1.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.9.0 tqdm/4.30.0 CPython/3.6.1

File hashes

Hashes for randomtimestamp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5bcd08c790b777419b382e788e99d3753c3ee58df3ec979b5726aa7c7af7cd99
MD5 4fbc316d34da1a87cacaf30eca57857b
BLAKE2b-256 08198e72289ef87daa333c796e2ac4d5c08845f10e5cfa6dacd3a476efa6ab8f

See more details on using hashes here.

File details

Details for the file randomtimestamp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: randomtimestamp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.7.1 requests-toolbelt/0.9.0 tqdm/4.30.0 CPython/3.6.1

File hashes

Hashes for randomtimestamp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee41c62ccab7ddfdabc7bdb8d4597b90b65e5d1d0689192aac511f571c7eeb5c
MD5 0eacd9e1a0404ede5915111568847dd4
BLAKE2b-256 ae8fac1c8e1ea0e15fe8e77654b9bec938d1bdf50bf9543975eec577af09adb5

See more details on using hashes here.

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