Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Time Humanizer

A lightweight, zero-dependency Java utility for converting millisecond timestamps into human-readable relative time strings.

Purpose

Time Humanizer was built as part of JavaLabs.io as a small, reusable Java component that can be integrated into other applications.

It converts raw millisecond timestamps into intuitive relative time expressions such as:

  • just now
  • a minute ago
  • 10 minutes ago
  • 5 hours ago
  • 3 days ago
  • a year ago

Use Cases

  • Social and activity feeds
  • Messaging systems
  • Notifications
  • Logs and monitoring dashboards
  • Reviews and activity history

Tech Stack

  • Java 21
  • Java Standard Library
  • Zero external dependencies

How It Works

Millisecond Timestamp
        ↓
Calculate Time Difference
        ↓
Convert Using TimeUnit
        ↓
Apply Relative Time Rules
        ↓
Human-Readable String

Future timestamps are treated as just now to handle slightly unsynchronized clocks.

Usage

String result = TimeUtils.toRelative(timestamp);

Example:

Time Humanizer output

Running

javac TimeUtils.java
java TimeUtils

Why I Built This

A small JavaLabs.io experiment focused on building reusable, dependency-free components that can be plugged into larger Java and Spring Boot applications.

JavaLabs.io

Part of JavaLabs.io, a collection of Java-first experiments focused on reusable components and backend systems.

About

A lightweight, zero-dependency Java utility for converting millisecond timestamps into human-readable relative time strings.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages