38 Replies
Ashley Terwilliger

Hi Martin,

I'm not sure if David is still subscribed here as I saw he also didn't answer Jacqui's similar question. I don't know much (or anything really!) about Javascript code, so I hope someone here in the community can pop in to assist. You could also try using the "contact me" button on a ELH users' profile to reach out to them directly for advice! Best of luck with your project! 

Michael Hinze

I think this simplified script here should do the trick;

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();
var CurTime = hours + ":" + minutes;

Michael Hinze

I just realized my earlier script suggestion would not account for hours and minutes< 10. They would be shown like "9:9". See attached a quick update that fixes this issue to show the hours and minutes always with two digits, e.g. "09:09". Here is the published example.

Susan Jorstad

This is a great thread, just what I need but I cannot get the DateTime_Test.story file from David above to work. The date works, but not the time. See attachment. I didn't make any changes except downloading the .story file and upgrading it to SL 360 and publishing and uploading to Canvas LMS. Any suggestions? I really need a date and time stamped on the results slide, right down to the seconds like this example shows. I'm not super good at JavaScript, but I do understand the need to create variables and the basics of how this should work. For instance, I have a variable that calls up the user's name from Canvas, and that works . . . . I've spent a lot more time than I expected looking at other threads, and help would be appreciated!