A lightweight, zero-dependency Java utility for converting millisecond timestamps into human-readable relative time strings.
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
- Social and activity feeds
- Messaging systems
- Notifications
- Logs and monitoring dashboards
- Reviews and activity history
- Java 21
- Java Standard Library
- Zero external dependencies
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.
String result = TimeUtils.toRelative(timestamp);Example:
javac TimeUtils.java
java TimeUtilsA small JavaLabs.io experiment focused on building reusable, dependency-free components that can be plugged into larger Java and Spring Boot applications.
Part of JavaLabs.io, a collection of Java-first experiments focused on reusable components and backend systems.
