3 Replies
Matthew Bibby

Set up a number variable in SL called day and add the following to an Execute JavaScript trigger which runs on timeline start:

var player = GetPlayer();
var d = new Date();
var n = d.getDate();
player.SetVar("day",n);

This will populate the day variable in SL with a number that represents the day of the month (e.g. 16) and you can use conditional triggers to do the rest.

ricky snodgrass

I have created a Storyline example that does exactly this,  as Mathew says, the only extra bit I would add is to use month too, probably not so much of an issue now but was a few days ago.

 

The code I use for all my date stuff is below, it also pulls in year if need be, 

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

if(dd<10) {
dd='0'+dd
}

if(mm<10) {
mm='0'+mm
}

date= dd;
month= mm;
var player = GetPlayer();
player.SetVar("date",date);
player.SetVar("month",month);

Heres my example,

https://rethinkingdigitaleducation.co.uk/storyline-advent-calendar/