Skip to content

tsaavik/Convert-Epoch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Convert Epoch

A simple Python utility that reads text from stdin and converts any 10-digit epoch timestamps to human-readable date/time format.

Description

This program searches for 10-digit epoch timestamps (Unix timestamps) in text input and converts them to a readable format while preserving the rest of the text. It's useful for analyzing log files, debugging output, or any text that contains epoch timestamps.

Features

  • Reads from standard input (stdin)
  • Automatically detects 10-digit epoch timestamps
  • Converts timestamps to human-readable format: Day Mon DD HH:MM:SS YYYY
  • Preserves original text structure
  • Interactive mode - use Ctrl+D to end input

Usage

From File

cat logfile.txt | convertepoch.py

From Command Output

some_command | convertepoch.py

Example

Input:

User login at 1609459200 was successful
Error occurred at timestamp 1609462800

Output:

User login at Fri Jan 01 00:00:00 2021 was successful
Error occurred at timestamp Fri Jan 01 01:00:00 2021

Installation

  1. Clone this repository:
git clone https://github.com/yourusername/Convert-Epoch.git
cd Convert-Epoch
  1. Make the script executable:
chmod +x convertepoch.py

Requirements

  • Python 3.x
  • No external dependencies (uses standard library only)

Notes

  • Only detects exactly 10-digit numbers as epoch timestamps
  • Uses local timezone for conversion
  • Timestamps before 1970 or after 2038 may not work correctly on some systems

License

This project is open source. Feel free to use and modify as needed.

Contributing

Feel free to submit issues and pull requests to improve this utility.

About

Python utility to convert epoch style timestamps into human readable format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages