Skip to main content

Generate random time stamps

Project description


Random timestamp generator


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

Command line usage

To use the script from command line

  30-08-1995 17:58:14

Python Package Usage

The function randomtimestamp takes two optional arguments:


The default values of start_year and text are 1950 and True respectively. The timestamp is generated between 1950 and current 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

  '02-06-1970 23:34:10'

  '02-06-2013 23:34:10'  

  '10-04-2015 10:55:02'  

  datetime.datetime(2010, 5, 16, 3, 32, 18)

  datetime.datetime(1951, 2, 13, 18, 19, 1)


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.

Files for randomtimestamp, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size randomtimestamp-1.0.0-py3-none-any.whl (15.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size randomtimestamp-1.0.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page