Skip to main content

time with zone+7 package

Project description

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

  1. 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)
    

     

  2. 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.    
    

     

  3. 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.
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

damv1time7-0.6.4-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file damv1time7-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: damv1time7-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.3

File hashes

Hashes for damv1time7-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eec9447f874b160524359526e1f48145317672bb469330c06b13c056f5aadb79
MD5 3979ceaf6cf3668a600f29c051e0c394
BLAKE2b-256 ec49642d749f19636e6b287d3f56c7b789d232525b3b2781b3fb3362603e5a02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page