Timer/Alarm App

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
1.19.3

Describe the thingy
Was wondering how to make a clock app (Alarm, Timer, Stopwatch) with selectable sounds (Choose between 4 sounds)

What have you tried so far?
I have a basic clock UI

Do you have a Wick Editor File that we can see? Optional*

stop watch is easy

but how do i translate unix time into seconds and minutes

and don’t forget alarms and timers

how to get time information from a unix time:

var date = new Date(unixTime)
// You can get seconds/minutes/hours/years from Date objects
// And make them account for timezones
// This constructor takes a unix time
// Also Date.now() returns the current unix time

var seconds = date.getSeconds() // seconds in a minute (0-59)
var minutes = date.getMinutes() // minutes in an hour (0-59)

For timers you can make it store when the timer should end. Then get the time between now and then. It’d probably be like the number of milliseconds. Then convert that to seconds, minutes, hours, e.t.c and display that nicely.

For alarms, I guess you can get the amount of time that has passed since the beginning of the day using the getHours(), getMinutes(), and getSeconds() functions, and convert that into a single number using basic math. Store that for the alarm time. Then every once in a while, get the current time using the method I explained, and check if it passed the alarm time. If it did, the alarm goes off, and it disables that alarm until the next day, which would be told as the time since the start of the day being less than an older value.

1 Like

Just remember… we use js for our wick apps… your question is about 90% js.

Here are some youtube tutorials…
https://www.youtube.com/results?search_query=how+to+create+a+clock+alarm+in+js

1 Like