Could anyone (or Brian) please tell me how to modify Brian's javascript so that I can get the current date minus x number of days. The script needs to recognize that the result has to be an actual date; not a negative number. So, if it's only 12/3/2013, subtracting 5 days shows 12/28/2013, NOT 12/-2/2013.
Here's the script which works to get today's date:
var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() var dateString=month + "/" + day + "/" + year var player = GetPlayer(); player.SetVar("SystemDate",dateString);
Close, but not exactly. Please see my screen grabs. The first shows the screen in Storyline. The text variable (pointed to by the arrow), when run in the browser, will reveal today's date without the slashes (e.g., 12192013). I need it show today's date MINUS 6 days (e.g., 12132013). Thanks for your help!!
Mike, this is very close! However, I simply want the text field to show today's date minus 6 days without the user having to click a radio button. It should automatically appear when the user arrives at this screen. That date should just simply appear like this: "The date is 12142013" (for when today's date is 12/20/2013). I tried tweaking the code but I wasn't able to get the text field to display. Any final help? (I promise, I won't bug you again!)
7 Replies
Do you want something like this: http://dev.keypointlearn.com/xcl71_SL/SubtractDcate/V1/story.html ? If yes, let me know and I'll post the .story file.
Close, but not exactly. Please see my screen grabs. The first shows the screen in Storyline. The text variable (pointed to by the arrow), when run in the browser, will reveal today's date without the slashes (e.g., 12192013). I need it show today's date MINUS 6 days (e.g., 12132013). Thanks for your help!!
How about this then: http://dev.keypointlearn.com/xcl71_SL/SubtractDcate/V4/story.html
Mike, this is very close! However, I simply want the text field to show today's date minus 6 days without the user having to click a radio button. It should automatically appear when the user arrives at this screen. That date should just simply appear like this: "The date is 12142013" (for when today's date is 12/20/2013). I tried tweaking the code but I wasn't able to get the text field to display. Any final help? (I promise, I won't bug you again!)
See attached the revised file.
Thanks Michael for helping out Curt here!
That did it! Thank you, Mike!! I really appreciate your help. Awesome product and fantastic support!
This discussion is closed. You can start a new discussion or contact Articulate Support.