System Date with out suffix

Oct 13, 2016

Hello,

I am using the following JavaScript to include the date when printing a slide. The script works, except that the format of the date has a suffix attached, ie.

Wednesday, October 12nd, 2016 or Thursday, October 13rd, 2016 (the system doesn't recognize that it's a double-digit number and only assigns the suffix based off of the number in the ones place).  Is there a way to either fix this, or have the suffix removed all together?

The system date also appears this way when the variable is recalled on the slide using %SystemDate%

 

myWindow = window.open("","Print","width=810,height=610,scrollbars=1,resizable=1");
var player=GetPlayer();
var headline=("Module 3 Notes");
var date=player.GetVar("SystemDate");
var exercisenotes1=player.GetVar("relationship");
var exercisenotes2=player.GetVar("investment");


var contents = "<html><head></head><body style='width:650px;padding:20px;'>"
contents+="<div style='font-size:22px;font-weight:bold;margin-top:20px;margin-bottom:20px;'>"+headline+"</div>";
contents+="<div style='font-size:16px;'>"+date+"</div>";
contents+="<div style='font-size:18px;font-weight:bold;margin-top:10px;'>Relationship Type</div>";
contents+="<div style='font-size:17px;margin-top:5px;'>"+exercisenotes1+"</div>";
contents+="<div style='font-size:18px;font-weight:bold;margin-top:10px;'>Reflect on Investment</div>";
contents+="<div style='font-size:17px;margin-top:5px;'>"+exercisenotes2+"</div>";
contents+="</body></html>"

 

1 Reply
Brian Dennis

Sounds like you're needing a bit more javascript to pull apart the 'date' variable. A web search of javascript date string parsing might prove fruitful. By the way you might consider another way via javascript to fetch the date (see Date() call) is more robust, standard javascript and less likely to disappear should SL's player undocumented system variables change

This discussion is closed. You can start a new discussion or contact Articulate Support.