Skip to main content

Timestamp enumerator

Project description

tsenum

Tests

A timestamp generator.

Install

You can use pip to install from the repository

pip install tsenum

or download sources and run pip from this directory

git clone https://github.com/aboehm/tsenum
pip install .

Usage

tsenum provides an CLI. For help run:

tsenum -h

To count 7 days back from yesterday via CLI, run:

tsenum --offset -1 --count -7 --step day --pattern "%Y-%m-%d: Hello world!"
2016-05-27: Hello world!
2016-05-28: Hello world!
2016-05-29: Hello world!
2016-05-30: Hello world!
2016-05-31: Hello world!
2016-06-01: Hello world!
2016-06-02: Hello world!

To do it programmatically:

from datetime import datetime
import tsenum

print(
    tsenum.enumerate_times(
        datetime.now().astimezone(),
        offset=-1,
        count=-7,
        step=tsenum.Step.DAY,
        pattern='%Y-%m-%d'
    )
)

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

tsenum-1.2.0.tar.gz (12.0 kB view hashes)

Uploaded Source

Built Distribution

tsenum-1.2.0-py3-none-any.whl (10.6 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