Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Is there a way to make a working clock?

A topic by Stabberz created Mar 15, 2025 Views: 163 Replies: 3
Viewing posts 1 to 3
(+1)

hi! as the title says is there a way to make a working clock? and is it possible to have it read different time zones? I'm currently trying to make a small site for me and a few friends to keep track on each others time zones so it would be really helpful if this was a possibility!

(+4)

Short answer, yes but it'll take some scripting.

You can get the time as a UNIX epoch (i.e. number of seconds since January 1 1970 0:00 UTC) using sys.now, and at least by default you can format that as ISO-8601 format using a format string like

"%e" format sys.now

It should be possible to make a clock by having an animation that updates a field with the time from sys.now and formats it however you want. With some custom code you should be able to format the time differently and show different timezones and such.

The "%p" format can be used to parse out an ISO-8601 timestamp into its individual parts, so you could use this to e.g. get the hours/minutes/seconds and adjust accordingly for timezone

e.g

"%p" parse "2025-03-15T11:44:08Z"

produces the dictionary

{"year":2025,"month":3,"day":15,"hour":11,"minute":44,"second":8}

There is in fact a contraption that essentially already is a clock - but it's in Swatch Internet Time - it could help as a starting point though. https://itch.io/post/7942346

Sorry if this answer is a bit more code-heavy and technical than you were hoping for, but this is how I'd approach things. If you've not got much coding experience then, hey maybe this is a chance to learn :)

Thank you for the help! im very very new to decker so im still not sure how to do things yet but i appreciate the help! its definitely much needed help!

(1 edit) (+2)

This was timely (pun intended) and helpful as I was also just thinking about potentially needing a clock type thing. Thanks all!