Forum Discussion
Actual clock showing actual time
Hi Diarmaid
I created this demo of a real-time clock with seconds and I think I made it 24 hour:
https://demo10.profilelearning.com
The JavaScript I used in this Storyline module is:
const date = new Date();
const time = date.toTimeString();
const hours = time.substring(0,2);
const minutes = time.substring(3,5);
const seconds = time.substring(6,8);
//Get Player and set variables
var player = GetPlayer();
player.SetVar("H",hours);
player.SetVar("M",minutes);
player.SetVar("S",seconds);
Obviously H, M and S are the Storyline Variables used in the clock display. I would load the story file but it was done very quickly for another post and if you accidentally try and 'preview' it it gets in an infinite loop you can't exit from! I should really tidy it up a bit.
But if this is helpful let me know if you need more information.
- JohnCooper-be3c2 years agoCommunity Member
Oh, by the way - the font used in the display is 'Digital-7 Mono' If I remember it took me a while to find a font that replicated a digital clock display...