I would like to add the date variable to a completion certificate. I have the JavaScript coding to capture the current system date, however, I want to ensure that the date locks and doesn't change each time the SCORM is accessed. Also, I want to display the date as full month description, day and year (i.e. January 1, 2015). Does anyone have the JavaScript coding for full month, day and year, with the lock down feature?
Here is the code that I went with and it works perfectly:
var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var today = new Date(); var dd = today.getDate(); var mm = today.getMonth(); var yyyy = today.getFullYear(); if(dd<10) { dd='0'+dd } var date= m_names[mm]+' '+dd+', '+yyyy; var player = GetPlayer(); player.SetVar("SystemDate",date);
Hi Jackson, I was looking in the archives trying to find some script to take the current date and modify it for a simulation. Basically I want to take the day the learner is taking the course a create 4 variables to be displayed in the simulation:
Last Payment date 1 = previous month on the 1st of the month
Last Payment date 2 = previous month on the 15th of the month
33 Replies
This post was removed by the author
Here is the code that I went with and it works perfectly:
var m_names = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December");
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth();
var yyyy = today.getFullYear();
if(dd<10) { dd='0'+dd }
var date= m_names[mm]+' '+dd+', '+yyyy;
var player = GetPlayer();
player.SetVar("SystemDate",date);
Thank you, Jackson! :)
Thanks Gene! That's what makes this community go! Learning and sharing :) Thank you.
Hi nice article.
Thanks to the author.i've worte an article on javascript formatting a date.
http://www.wikitechy.com/view-article/formatting-date-in-javascript-month-day-year
Please Visit! :)
Thanks for sharing Venkat!
Hi Jackson, I was looking in the archives trying to find some script to take the current date and modify it for a simulation. Basically I want to take the day the learner is taking the course a create 4 variables to be displayed in the simulation:
Last Payment date 1 = previous month on the 1st of the month
Last Payment date 2 = previous month on the 15th of the month
Due Date 1 = next month on the 1st of the month
Due Date 2 = next month on the 15th of the month
This will keep the dates fresh in the course.
Any ideas? Thanks!
A~
I see this was 3 years ago but I just applied this to my project for a date on a certificate. It worked very well. Thanks for the solution.
Awesome Jeffrey! Glad that this thread was able to help you as well :) Thanks for chiming in!
hi Jackson,
since you rock on building JavaScript do you know how cab be added x hours between quiz attempts?
thank you!
This discussion is closed. You can start a new discussion or contact Articulate Support.