TimeLab
This library handles everything related to time, Heres an example of how to use this library:
from timelab import TimeSpan
timespan = TimeSpan(minutes=100)
print(timespan.seconds) # Output: 0
print(timespan.minutes) # Output: 100
print(timespan.hours) # Output: 0
# Find total
print(timespan.total_seconds()) # Output: 6000
print(timespan.total_minutes()) # Output: 100
print(timespan.total_hours()) # Output: 1.6~
# Add time
print(TimeSpan(minutes=100) + TimeSpan(minutes=30)) # Output: TimeSpan(130 minutes)
# Subtract time
print(TimeSpan(minutes=100) - TimeSpan(minutes=30)) # Output: TimeSpan(70 minutes)
# Normalize time
# Normalize() will normalize the time format to make it more readable
print(TimeSpan(seconds=125).normalize()) # Output: TimeSpan(2 minutes, 5 seconds)
print(TimeSpan(hours=2.5).normalize()) # Output: TimeSpan(2 hours, 30 minutes)
# Get time as dictionary
print(TimeSpan(hours=2.5).as_dictionary()) # Output: {'hours': 2.5, 'centuries': 0.0, 'years': 0.0, ...}
print(TimeSpan(hours=2.5).as_dictionary()) # Output: {'hours': 2.5, 'centuries': 0.0, 'years': 0.0, ...}
# As datetime
print(TimeSpan(hours=2.5).as_datetime()) # Output: DateTime(2.5 hours)
And usage for datetime:
from timelab import DateTime, TimeSpan
# Timestamp
print(DateTime.now().timestamp()) # Output format: Year-Month-Day
# Timestamp with custom format
print(DateTime.now().timestamp(time_format='Year: %Y, Month: %M, Day: %D')) # Output format: Year: Year, Month: Month, Day: Day
# As timespan
print(DateTime.now().as_timespan())
# Add and subtract timespan to datetime
print(DateTime.now() + TimeSpan(minutes=30))
print(DateTime.now() - TimeSpan(minutes=30))
# Get difference between 2 datetimes
print(DateTime.now() - DateTime.now()) # Returns the difference as a timespan
Metadata
Release files for timelab 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| timelab-1.0.tar.gz | 5.5 kB | Without provenance | Details for timelab-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| timelab-1.0-py3-none-any.whl | Python 3 | none | any | Details for timelab-1.0-py3-none-any.whl |
Total release size: 11.5 kB
Release files / timelab-1.0.tar.gz
| Download URL | timelab-1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2719ecee39dc2ac7a1c90adc523e46c189082aaa9a4ef1b0ffc9cf8da58372aa
|
|
BLAKE2b-256 checksum How to use checksums |
266babaffef399821452e7d6d3a0f52848d5dc8b1d7eb2dc4bf0fe5df8fec775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / timelab-1.0-py3-none-any.whl
| Download URL | timelab-1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a296b4dcc82f21df5b81a8d398903a2a54bc15808297400f847a775b748a548d
|
|
BLAKE2b-256 checksum How to use checksums |
7d94145780a2e871a9f4c90f5c5135b704a7dddb7d7a48ad8f7f894694227681
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for timelab 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.