Forum Discussion
SteveMarlow-0fc
2 years agoCommunity Member
Javascript variable / Current Date
Hello, Can someone give me the javascript to display the current date by using a variable? It is similar to the below javascript but I need it to display the date numerically like "06/20/2023" v...
SteveMarlow-0fc
2 years agoCommunity Member
I found this solution. Thanks.
%todaysDate%
let currentTime = new Date();
let month = currentTime.getMonth() + 1;
let day = currentTime.getDate();
let year = currentTime.getFullYear();
// Putting it together
let dateString = month + "/" + day + "/" + year;
//Pushing data to Storyline
let player = GetPlayer();
player.SetVar("todaysDate", dateString);
player.SetVar("month", month);