A utility for creating datetime-based strings for file naming
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.3.tar.gz
(2.9 kB
view details)
Built Distribution
tlid-0.1.3-py3-none-any.whl
(3.2 kB
view details)
File details
Details for the file tlid-0.1.3.tar.gz
.
File metadata
- Download URL: tlid-0.1.3.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c783df5831aa60949808694fce59a2c73c66847fc030d6308f68b50f09d68a58 |
|
MD5 | bb704e1a72473bc16b6de288307ca214 |
|
BLAKE2b-256 | 6e9e2252754524ccada6eafe0ca7c03e071193e3916b6ae0c10cf864c0b26f15 |
File details
Details for the file tlid-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: tlid-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3240bb1cc39ebcf4acbfcd9fa1a1699ed87e8015e843c7bfe274459c5bae262e |
|
MD5 | 8d81398ac989443c853cc7823dce5b05 |
|
BLAKE2b-256 | 5b6f053acb282e64a8faebd689d10c5ea8c621209fe3c7d3ea258688d7a20bb1 |