Forum Discussion
How to insert current date variable into a "customised certificate slide".
Hi there,
I have created a certificate looking slide at the end of my course. I have added in variables for the learners name, their score achieved, I am just missing the date variable to be populated automatically.
I have followed the guide on the link below however it has not worked when I have tested it in a clients LMS (SABA). https://vimeo.com/145579723
I was just wondering if anyone could offer any assistance on this matter?
31 Replies
- ChristyGibersonCommunity Member
That's for the info!
Is it possible to have the date locked base on when their quiz was completed?
- WaltHamiltonSuper Hero
Use Matthew's code.
If you mean print year day month, change this line:
var date= dd+' '+m_names[mm]+', '+yyyy
to this:
var date= yyyy+' '+dd+' '+m_names[mm]
or year month day, change it to:
var date= yyyy+' '+m_names[mm]+', '+dd
If you want print the year before this year, change this line:
var yyyy = today.getFullYear();
to this:
var yyyy = today.getFullYear()-1;
- ALitchfieldCommunity Member
Hi everyone,
I have used this javascript for other instances in my courses, but I'm wondering if I could change it to show the year prior? For example for copyrights, we need to update all to 2020 and If I could create a script to auto-populate the year prior to the current day. Any tips how to do that? TIA!
- MargaretHartofiCommunity Member
Hi Everyone,
This is a very helpful thread. I was able to correctly add the system date to a certificate I created. However, it appears the user has the ability to edit the date on the certificate slide. Does anyone know how to prevent this? Thank you! - VickieSubletteCommunity Member
It worked, Matthew! You are amazing! Thank you so much!
- VickieSubletteCommunity Member
That is great, but I don't know Javascript well enough to make it into the Date Month Year format. For example, 14 March, 1962.
I have moved the quotes all around, but I'm not sure which goes where and after 9 tries, I am giving up.
Please help!
- SylviaWrightCommunity Member
Wow! This is terrific!! THANKS!
Thanks for the update John :) Glad you were able to get that sorted.
- JohnBlumCommunity Member
Hi Ashley,
Thank you for the additional info. Very helpful! I had published -- the problem was a typo.
I edited the JavaScript as follows so I could extract the current year which we need for a new corporate standard.
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);
player.SetVar("month",month);
player.SetVar("day",day);
player.SetVar("year",year);Thank you,
John
Hi John,
Did you publish and upload to your web server or LMS? Testing Javascript locally is one of the known causes for it to not work, and you may want to take a look at the information here in regards to the Javascript best practices as it's not something our team can offer support for.
Related Content
- 12 months ago
- 4 months ago
- 11 months ago