Forum Discussion
User notes that they can print and email
I know this is an old post, but thanks so much for sharing, this has been a life saver as I need to print a report from the current package I'm working on, and this works perfectly.
Just a note: when I used the date I got 13rd rather than 13th, I've found a comment on the following post with code that works so it will do 1st, 2nd, 3rd but not 13rd, in case it's useful for anyone.
(Courtesy of Mark Bennett)
var today = new Date();
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var s = ["th","st","nd","rd"];
var day = today.getDate();
var month = today.getMonth();
var year = today.getFullYear();
var v = day%100;
var dd = day+(s[(v-20)%10]||s[v]||s[0]);
var date = dd + " " + monthNames[month] + " " + year;
var player = GetPlayer();
player.SetVar("SystemDate",date);
That's a great solution. I often use this JS library when I need to
display/manipulate time or dates.
https://momentjs.com/
Thank you,
James Kingsley
Need an awesome way to collect feedback?
Don't just collect feedback. Start a conversation.
ReviewMyElearning.com