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);
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes
minutes = "0" + minutes
var suffix = "AM";
if (hours >= 12) {
suffix = "PM";
hours = hours - 12;
}
if (hours == 0) {
hours = 12;
}
var CurTime = hours + ":" + minutes + " " + suffix ;
player.SetVar("TimeValue",CurTime);
- JacquiDyach9 years agoCommunity Member
How would you display the time in 12 hour format (instead of 24 hour)?
Related Content
- 9 months ago
- 9 months ago
- 9 months ago