DEV Community

Ravi Kumar
Ravi Kumar

Posted on

I Built a Timestamp Converter That Doesn't Suck (And It's Free)

How many times have you been debugging API logs, staring at 1706745600, and thought "What date is this even?"

You Google "unix timestamp converter," click the first result, and get hit with:

  • Three banner ads
  • A dropdown to select "Unix timestamp (seconds)"
  • Another dropdown to select output format
  • More ads
  • Oh, and it wants you to sign up

I got tired of this. So over a weekend, I built TimeStampConverter.net - a timestamp converter that just works.

What Makes It Different?

Auto-Detection

Paste anything. The tool figures out if it's:

  • Unix timestamp (seconds): 1706745600
  • Unix timestamp (milliseconds): 1706745600000
  • ISO 8601: 2024-01-31T12:00:00Z
  • RFC 2822: Thu, 31 Jan 2024 12:00:00 GMT
  • Human readable: January 31, 2024

No dropdowns. No clicking. It just knows.

One Paste, Seven Formats

One paste shows all these formats simultaneously:

Unix (seconds):     1706745600
Unix (ms):          1706745600000
ISO 8601 (UTC):     2024-01-31T17:00:00.000Z
ISO 8601 (Local):   2024-01-31T12:00:00.000-05:00
RFC 2822:           Wed, 31 Jan 2024 12:00:00 -0500
Human:              January 31, 2024 12:00:00 PM
Relative:           2 hours ago
Enter fullscreen mode Exit fullscreen mode

Each has a copy button. Click once, paste into your code.

400+ Timezones

Searchable timezone dropdown. Type "Tokyo" and it jumps there. Convert to any timezone instantly.

Date Math Built-In

Need to know what timestamp is "30 days from now"? There's a calculator for that:

  • Add/subtract: years, months, days, hours, minutes, seconds
  • Duration between two timestamps
  • Handles DST and leap years correctly

Bulk Conversion

Paste multiple timestamps (one per line), convert them all at once. Perfect for log analysis.

URL Sharing

Share specific timestamps: https://timestampconverter.net?ts=1706745600

Dark Mode by Default

Because you're probably using this at 2 AM debugging prod issues.

Zero Tracking

No analytics. No ads. No signup. No cookies. Everything runs client-side.

The Tech Stack

I kept it brutally simple:

// That's it. That's the whole dependency list.
{
  "dependencies": {
    "dayjs": "^1.11.10"
  }
}
Enter fullscreen mode Exit fullscreen mode
  • Vanilla JavaScript - No React, no Vue, no build step
  • day.js - Lightweight date library (~2KB)
  • Cloudflare Pages - Free hosting with global CDN
  • Total bundle size: ~50KB

Why Vanilla JS?

I know what you're thinking: "Nobody uses vanilla JS anymore!"

But here's the thing - this app:

  1. Doesn't need state management
  2. Doesn't need routing
  3. Doesn't need a virtual DOM
  4. Needs to load fast

A React app with similar functionality would be 200KB+. This loads in under 100ms anywhere in the world.

How Auto-Detection Works

The secret sauce is a simple regex-based detection:

function detectTimestampFormat(input) {
  const trimmed = input.trim();

  // Unix timestamp (10 digits = seconds)
  if (/^\d{10}$/.test(trimmed)) {
    return { type: 'unix-seconds', value: parseInt(trimmed) };
  }

  // Unix timestamp (13 digits = milliseconds)
  if (/^\d{13}$/.test(trimmed)) {
    return { type: 'unix-ms', value: parseInt(trimmed) };
  }

  // ISO 8601 (starts with YYYY-MM-DDT)
  if (/^\d{4}-\d{2}-\d{2}T/.test(trimmed)) {
    return { type: 'iso8601', value: trimmed };
  }

  // RFC 2822 (starts with day name)
  if (/^[A-Za-z]{3},\s\d{2}\s[A-Za-z]{3}\s\d{4}/.test(trimmed)) {
    return { type: 'rfc2822', value: trimmed };
  }

  // Try generic date parsing
  const parsed = dayjs(trimmed);
  if (parsed.isValid()) {
    return { type: 'generic', value: trimmed };
  }

  return { type: 'invalid', value: null };
}
Enter fullscreen mode Exit fullscreen mode

Once detected, converting is trivial with day.js:

function convertTimestamp(detected) {
  let date;

  switch(detected.type) {
    case 'unix-seconds':
      date = dayjs.unix(detected.value);
      break;
    case 'unix-ms':
      date = dayjs(detected.value);
      break;
    default:
      date = dayjs(detected.value);
  }

  return {
    unixSeconds: date.unix(),
    unixMs: date.valueOf(),
    iso8601UTC: date.utc().format(),
    iso8601Local: date.format(),
    rfc2822: date.format('ddd, DD MMM YYYY HH:mm:ss ZZ'),
    humanReadable: date.format('MMMM D, YYYY h:mm:ss A'),
    relative: date.fromNow()
  };
}
Enter fullscreen mode Exit fullscreen mode

Deployment on Cloudflare Pages

This was the easiest part:

# 1. Build (or just use raw files)
# (nothing to build for vanilla JS!)

# 2. Deploy
wrangler pages deploy . --project-name=timestamp

# Done. Live globally in ~30 seconds.
Enter fullscreen mode Exit fullscreen mode

Cloudflare gives you:

  • Unlimited bandwidth (actually unlimited on free tier)
  • 300+ edge locations
  • Automatic HTTPS
  • Preview deployments for every git push
  • Built-in analytics

All for $0/month.

What I Learned

1. Sometimes Vanilla JS is the Right Choice

Not everything needs a framework. For small utilities, vanilla JS + a tiny library can beat any framework on performance.

2. Auto-Detection is Magical UX

Users love tools that "just work." No configuration, no dropdowns, just paste and go.

3. Dark Mode Should Be Default

Especially for dev tools. We're often using these at night or in dark IDEs.

4. Cloudflare Pages is Underrated

Vercel and Netlify get all the love, but Cloudflare's free tier is genuinely unlimited and faster for global users.

5. Solve Your Own Problem

I built this because I was frustrated. Now I use it 20+ times a day. That's validation enough.

What's Next?

Some features I'm considering:

  • Browser extension (right-click timestamp → convert)
  • API endpoint for programmatic access
  • Cron expression validator
  • ISO week number calculator

But honestly? The tool does what I need. I might just leave it as-is.

Try It Yourself

TimeStampConverter.net

No signup, no tracking, no BS. Just timestamps.

If you find it useful, bookmark it. That's all I ask.


FAQ

Q: Is this open source?

A: Not yet, but I'm considering it. If there's interest, I'll put it on GitHub.

Q: How do you make money from this?

A: I don't. It costs $0/month to run. Maybe I'll add a "buy me a coffee" button someday.

Q: Can I use this for my app/API?

A: Everything runs client-side, so yeah, go nuts. If you need an API endpoint for server-side conversions, let me know - I might build one.

Q: What about privacy?

A: All conversions happen in your browser. I literally cannot see what you're converting. Cloudflare logs basic CDN metrics (requests per region, bandwidth) but no user data.

Q: Can you add features?

A: Maybe! Drop a comment below or email me through the site.

Top comments (0)