damv1time7 - Time and Logging Utility for Timezone +7
damv1time7 is a Python package that provides utilities for handling time and logging with a focus on timezone +7. It includes functions for generating timestamps, calculating time differences, and logging messages to both console and files.
Installation
You can install damv1time7 via pip:
pip install damv1time7
Features:
- Timezone +7 Support: All timestamps are generated in the timezone +7 (ICT - Indochina Time).
- Logging: Log messages to the console or to a file with timestamps.
- Time Utilities: Calculate time differences, convert timestamps, and more.
Usage
-
Time Utilities
⌘
currentTime7()
Get the current time in timezone +7.from damv1time7 import currentTime7 print(currentTime7()) # Output: 2025-10-10T12:34:56.789000+0700
⌘
generate_uuids_byTime7()
Generate UUIDs based on the current time in timezone +7.from damv1time7 import generate_uuids_byTime7 uuid = generate_uuids_byTime7() print(uuid) # Output: 1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed
⌘
convert_timestamp_to_datetimezone7()
Convert a timestamp to a datetime string in timezone +7.from damv1time7 import convert_timestamp_to_datetimezone7 timestamp = 1763072800000 # Example timestamp for the year 2025 converted_time = convert_timestamp_to_datetimezone7(timestamp) print(converted_time) # Output: 2025-10-01T12:00:00.000000+0700
⌘
difference_datetimezone7_by_day_from_now()
Calculate the difference in days between a target date and the current time in timezone +7.from damv1time7 import difference_datetimezone7_by_day_from_now target_date = "2025-10-01T12:00:00.000000+0700" days_diff = difference_datetimezone7_by_day_from_now(target_date) print(days_diff) # Output: 9 (example)
⌘
difference_datetimezone7_by_seconds_from_between()
Calculate the difference in seconds between two datetime strings in timezone +7.from damv1time7 import difference_datetimezone7_by_seconds_from_between first_date = "2025-10-01T12:00:00.000000+0700" last_date = "2025-10-01T14:30:00.000000+0700" seconds_diff = difference_datetimezone7_by_seconds_from_between(first_date, last_date) print(seconds_diff) # Output: 9000 (example)
-
Logging Utilities
⌘ custom_logger()
A simple logging function to log messages with a timestamp in timezone +7.from damv1time7 import custom_logger custom_logger("This is a custom log message.") # Output: 2025-10-10T12:34:56.789000+0700 This is a custom log message. -
File Handling
Writing Multiple Logs to a File
You can write multiple logs to the same file by reusing the file object.from damv1time7 import printlf_dump_v1 filename = "logfile.txt" file_obj = printlf_dump_v1(True, filename, "First log message.") file_obj = printlf_dump_v1(True, _file=file_obj, "Second log message.") file_obj.close() # Close the file when done
Contents of logfile.txt:
2025-10-10T12:34:56.789000+0700 2025-10-10T12:34:56.789000+0700 First log message. 2025-10-10T12:34:56.790000+0700 Second log message.
Metadata
Release files for damv1time7 0.6.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| damv1time7-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for damv1time7-0.6.4-py3-none-any.whl |
Release files / damv1time7-0.6.4-py3-none-any.whl
| Download URL | damv1time7-0.6.4-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eec9447f874b160524359526e1f48145317672bb469330c06b13c056f5aadb79
|
|
BLAKE2b-256 checksum How to use checksums |
ec49642d749f19636e6b287d3f56c7b789d232525b3b2781b3fb3362603e5a02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.3
|
Security for damv1time7 0.6.4
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.