Skip to main content

A single function to get a nice date-time format

Project description

neattime

This package includes a simple function to create my preferred date-time format for log files.

The date and time are given in the format yyyy-MM-dd_HH-mm-ss_SSSS

I like this format because it's easy to sort, doesn't interfere with file reading/writing by having unusual characters, is easy to understand, and includes milliseconds to prevent concurrent processes from overwriting each other's log files.

Installation

pip install neattime

Usage

Example:

from neattime import neattime

print(neattime())

output:

'2025-02-26_08-34-13_636609'

How I would actually use it:

from neattime import neattime

filepath = f'save_directory/log_{neattime()}'

# some code that saves my logfile

print(f"File saved to {filepath}")

output:

File saved to save_directory/log_2025-02-26_08-34-13_636609

Project details


Download files

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

Source Distribution

neattime-0.0.4.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

neattime-0.0.4-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file neattime-0.0.4.tar.gz.

File metadata

  • Download URL: neattime-0.0.4.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for neattime-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ff170e83ec5a39cc7f5aca2b1009e50661c20c4e639ca92452b19959aeb75b83
MD5 8f8507bf32681623eba3ebcb7e037e4a
BLAKE2b-256 8a811a6d7e417927383ab307b0813c4f345e9c891c947f8a22a052b24eb7b75c

See more details on using hashes here.

File details

Details for the file neattime-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: neattime-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for neattime-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e87f56a6ac0da94dac2e03a397edb500a529b6620c822d1356196af980fe19ed
MD5 7a6526215d4bdc58ec052f6e30a6eff4
BLAKE2b-256 3f2c22c1c820ba9b08de42c3b5aa424853e2278ac64bbfb04bb2b99c8a36088c

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