Menu

1 / 3

A world clock that doesn't trust your clock: lessons from 64 500 city pages in plain PHP

DEV Community: javascript·Konstantin Iliev·10 days ago
#zoHO5wFD
#devtojavascript#devto#dev#time#zone
Reading 0:00
15s threshold

I built WhatTimeIsIt.zone , a site that answers one question for about 64 500 places in 245 countries and territories: what time is it there right now? Each place has its own page with the time, the time zone, the next clock change, sunrise and sunset, the moon, the weather and the next public holiday. There are also 25+ small tools (a time zone converter, a time zone map, holidays in 247 countries, calendars and so on), in English and Bulgarian.

The stack is deliberately boring: plain PHP 8 and MariaDB on a shared hosting plan with LiteSpeed, no framework, no front-end framework, a few small vanilla JavaScript files. A git push to main deploys it.

"Show the time" sounds like a one-liner, but it turned out to be full of small traps. Here are the ones I found most interesting.

1. Your device clock is often wrong, so measure it

A clock in the browser is only as good as Date.now() , and the device clock can be off by seconds or even minutes. So the page measures it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.