<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8" -->

---
title: Encoding the timestamp into a sortable ID, is this a bad...
description: A developer proposes a 16-character human-readable sortable ID format that embeds calendar information (month, ISO week, weekday) directly into the ID string...
canonical: https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Encoding the timestamp into a sortable ID, is this a bad design? | daily.dev
og:description: A developer proposes a 16-character human-readable sortable ID format that embeds calendar information (month, ISO week, weekday) directly into the ID string...
og:url: https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8
og:image: https://api.daily.dev/og/posts/GSaYbCUk8.png
og:image:alt: Encoding the timestamp into a sortable ID, is this a bad design?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Encoding the timestamp into a sortable ID, is this a bad design?

**[Aris Ripandi](https://daily.dev/sources/50beb8be38d649a58f801ea34982c74b)** · [@riipandi](https://daily.dev/riipandi) · 2 min read · 0 upvotes · 0 comments

## Summary

A developer proposes a 16-character human-readable sortable ID format that embeds calendar information (month, ISO week, weekday) directly into the ID string alongside a Unix millisecond timestamp. The format `{ms_hex:012}{month}{iso_week:02}{weekday}` maintains K-sortability because the big-endian timestamp prefix ensures lexicographic order equals chronological order. The tradeoff is only 3 random bits remain, making it unsuitable for distributed ID generation due to collision risk within the same millisecond. The post invites design critique on whether exposing calendar data is a feature or privacy leak, whether the letter encoding is intuitive, and whether 16 characters is the right length.

## Content

I keep running into the same annoyance: "sortable" IDs (UUID v7, ULID, KSUID) are time-ordered but completely opaque. You can't tell when one was created without pasting it into a decoder. So I started wondering — what if the calendar were baked into the ID itself, so it's readable at a glance?

The sketch is a 16-char string:

```
{ms_hex:012}{month}{iso_week:02}{weekday}
```

So `019f631516e6g29o` isn't just sortable — you can read it:

- `019f631516e6` → Unix Epoch millisecond timestamp (the same one UUID v7 uses)
- g → July
- 29 → ISO week 29
- o → Wednesday

First 12 chars: the Unix millisecond timestamp in big-endian lowercase hex. Then one letter for the month (a=Jan..l=Dec), a zero-padded ISO week, and one letter for the weekday (m=Mon..s=Sun). So `019f631516e6g29o` reads as July, ISO week 29, Wednesday, 2026 — no tool needed.

It stays K-sortable because the timestamp is big-endian up front, so lexicographic order == chronological order, even across the December→January boundary. The calendar suffix is derived purely from the timestamp, so it can't break the sort. And it could reuse the exact same 48-bit millisecond timestamp UUID v7 already uses, so interop would be trivial.

The obvious tradeoff: only 3 random bits survive, so it's useless as a distributed-ID generator (collisions possible within the same millisecond) and not cryptographically secure. Fine for readable, sortable IDs in a single service — but I'm unsure where people land on the rest:

- Is exposing the calendar a feature or a leak? It makes logs and URLs readable, but also makes the timestamp trivially recoverable (UUID v7 doesn't exactly hide it either).
- The month/weekday letter mapping is arbitrary (a..l, m..s). Is there a more intuitive or collision-resistant encoding?
- Is 16 chars the right size, or would you drop the human-readable suffix and keep it shorter?

Curious for design critiques — not the implementation, the idea itself.

Repository: [https://github.com/riipandi/kalid](https://github.com/riipandi/kalid)

## Similar posts on daily.dev

- [UUID v4 vs v7, and what's inside a UUID](https://daily.dev/posts/uuid-v4-vs-v7-and-what-s-inside-a-uuid-buf3wbyzk) · Flavio Copes · 2 upvotes · 0 comments
- [Universally Unique Lexicographically Sortable Identifiers \(ULIDs\)](https://daily.dev/posts/universally-unique-lexicographically-sortable-identifiers-ulids--xfthi2f2b) · Marius Bancila · 0 upvotes · 0 comments
- [Fixing UUIDv7 \(for database use-cases\)](https://daily.dev/posts/fixing-uuidv7-for-database-use-cases--7dcyqgdhu) · Marc Brooker · 0 upvotes · 0 comments
- [UUID v7 vs. ULID: Which Sortable ID Should You Choose?](https://daily.dev/posts/uuid-v7-vs-ulid-which-sortable-id-should-you-choose--xlgz26hfk) · Ruby Flow · 0 upvotes · 0 comments
- [Time-based Universally Unique Identifiers \(UUIDs v7\)](https://daily.dev/posts/time-based-universally-unique-identifiers-uuids-v7--wdmbzpve0) · Marius Bancila · 2 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database)

[View this post on daily.dev](https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8","headline":"Encoding the timestamp into a sortable ID, is this a bad design?","text":"A developer proposes a 16-character human-readable sortable ID format that embeds calendar information (month, ISO week, weekday) directly into the ID string alongside a Unix millisecond timestamp. The format `{ms_hex:012}{month}{iso_week:02}{weekday}` maintains K-sortability because the big-endian timestamp prefix ensures lexicographic order equals chronological order. The tradeoff is only 3 random bits remain, making it unsuitable for distributed ID generation due to collision risk within the same millisecond. The post invites design critique on whether exposing calendar data is a feature or privacy leak, whether the letter encoding is intuitive, and whether 16 characters is the right length.","url":"https://daily.dev/posts/encoding-the-timestamp-into-a-sortable-id-is-this-a-bad-design--gsaybcuk8","datePublished":"2026-07-15T01:40:20.554Z","dateModified":"2026-07-15T01:44:05.250Z","author":{"@type":"Person","name":"Aris Ripandi","url":"https://daily.dev/riipandi","image":"https://media.daily.dev/image/upload/s--90o2_vHD--/f_auto,q_auto/v1/avatars/avatar_50beb8be38d649a58f801ea34982c74b","description":"Crafting webapps, solving business problems with technology. Open Source enthusiast. Always interested in modern web development and cloud computing.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/50beb8be38d649a58f801ea34982c74b","name":"Aris Ripandi"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Aris Ripandi","item":"https://daily.dev/sources/50beb8be38d649a58f801ea34982c74b"},{"@type":"ListItem","position":3,"name":"Encoding the timestamp into a sortable ID, is this a bad design?"}]}
```

