Forum Discussion
EdSteeds
13 years agoCommunity Member
Update a variable with the current date and time
Is it possible to insert the date and time into a variable to be displayed on screen.
What I want to achieve:
To time an activity that takes place over a number of slides.
Happy to use Java...
SinchuRaj-
13 years agoCommunity Member
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear();
var player = GetPlayer();
var newName = day + "/" + month + "/" +year
player.SetVar("DateValue", newName);
DateValue is my variable in the storyline, it should be a text value
GQuicano
18 days agoCommunity Member
Thanks for sharing this. In case someone needs the year in only two digits, you can add % 100 at the end of the year line:
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear() % 100;
var player = GetPlayer();
var newName = day + "/" + month + "/" +year
player.SetVar("DateValue", newName);
Related Content
- 10 months ago
- 10 months ago
- 10 months ago