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 formats: Current seconds in YYMMDDHHMMSS formatms: Current milliseconds in YYMMDDHHMMSSmmm formatm: Current month in YYMM formatM: Current month in YYMM format (same asm)y: Current year in YY formatd: 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
Release history Release notifications | RSS feed
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.17.tar.gz
(3.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tlid-0.1.17-py3-none-any.whl
(3.9 kB
view details)
File details
Details for the file tlid-0.1.17.tar.gz.
File metadata
- Download URL: tlid-0.1.17.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fc707eecef99d6eb5872ce9e3afffd684beacba4bd260bb73450e5efb8e6dfd
|
|
| MD5 |
15d9e122f1ffba842cc1e9a1c7c0edda
|
|
| BLAKE2b-256 |
46d4802c6d7a2b2c8e80c541fc0add65a4490ab279b13dfac924358495ea3bac
|
File details
Details for the file tlid-0.1.17-py3-none-any.whl.
File metadata
- Download URL: tlid-0.1.17-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc48c4fbe63889f1fcd01f4e7891cbd147c26d038b876390466aa71d8fd03259
|
|
| MD5 |
b47f55e4278738992b64ea7ab5969266
|
|
| BLAKE2b-256 |
ffb50d07b4057d4e62c001a164d8eb274dff98aa4d1d0fd37b6d1087f704e5bb
|