Skip to main content

A utility for creating datetime-based strings for file naming in timeline.

Project description

tlid

Installation

pip install tlid

Usage:

import tlid

# Get TLID
tlid_str = tlid.get_tlid()
print(tlid_str)  # Outputs: YYMMDDHHMMSS

# Get TLID with milliseconds
tlid_milli = tlid.get_milliseconds()
print(tlid_milli)  # Outputs: YYMMDDHHMMSSmmm

# Get TLID for different time granularities
print(tlid.get_seconds())  # Outputs: YYMMDDHHMMSS
print(tlid.get_minutes())  # Outputs: YYMMDDHHMM
print(tlid.get_hour())     # Outputs: YYMMDDHH
print(tlid.get_day())      # Outputs: YYMMDD
print(tlid.get_month())    # Outputs: YYMM
print(tlid.get_year())     # Outputs: YY

# Check if a string has a TLID
print(tlid.has_tlid('Hello 210101010101 World'))  # Outputs: True

# Extract TLID from a string
print(tlid.extract_tlid('Hello 210101010101 World'))  # Outputs: 210101010101

# Clean a string from its TLID
print(tlid.clean_tlid('Hello 210101010101 World'))  # Outputs: Hello World

# Convert a TLID string to a datetime object
print(tlid.to_date('210101010101'))  # Outputs: 2021-01-01 01:01:01
# pytlid

`pytlid` is a command-line interface for generating time-based identifiers using the `tlid` Python package.



## Usage

To use `pytlid`, simply run the command followed by the desired time unit. The default time unit is minutes if no argument is provided.

```sh
pytlid [unit]

Here are the available units and their corresponding outputs:

  • h: Current hour in YYMMDDHH format
  • s: Current seconds in YYMMDDHHMMSS format
  • ms: Current milliseconds in YYMMDDHHMMSSmmm format
  • m: Current month in YYMM format
  • M: Current month in YYMM format (same as m)
  • y: Current year in YY format
  • d: Current day in YYMMDD format

Examples

To get the current time in minutes:

pytlid

To get the current time in hours:

pytlid h

To get the current time in seconds:

pytlid s

For help:

pytlid --help

This will display the help message for the pytlid command.


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

tlid-0.1.16.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

tlid-0.1.16-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file tlid-0.1.16.tar.gz.

File metadata

  • Download URL: tlid-0.1.16.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for tlid-0.1.16.tar.gz
Algorithm Hash digest
SHA256 cd8756a51474c50960c8725f31e03a992046ef4c75dd4f00b6974241def4c586
MD5 ee2977f77a94647545a82418d8d7dfcd
BLAKE2b-256 002e4be6936c53460ea307f07b95170cf1410499713bd2ee2c5056a23b25c36d

See more details on using hashes here.

File details

Details for the file tlid-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: tlid-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for tlid-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 a339ef78b896cc16d2296b014e9cf6173f59261343b7381cc2c3e3fa339f6127
MD5 a939b41b04f0500c6d4060d7feec30c8
BLAKE2b-256 bab2c1371c02736c8e7a3eb8626c52e8a45a2ba59b1959ef8c934a001b7da47b

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