HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... Date / Time
Date / Time
  View type:
Hi Slav
Is there a way to get the computer date and time into CouserLab variables?
Thanks
 
Hi, Leo!
There's no direct date/time addressing in CourseLab variables, but there is simple workaround using JavaScript:

JAVASCRIPT [dMyDate = new Date;]
VARIABLE [name=MyDate, value=javascript: dMyDate.toLocaleString()]

MyDate will get full local date and time using toLocaleString() function. To get date only - use toLocaleDateString(), time - toLocaleTimeString() correspondingly. Other JavaScript date/time functions can be used, but they must return string or number (other types of objects are not supported in CourseLab variables).

Note also, that dMyDate is defined as global, therefore please do not use some simple names as "date", "dDate" to avoid interference with other variables. "dMyDate" is definitely not used in CourseLab, so this name is safe.
 
 
I am currently using courselab to build some training courses. Though I am coming along well, are there some step by step instruction on how to use the Java script tool/variable to input the data mentioned ealier to get dates and times on a slide. The software is excellent to include the info given out on the blogs. But for guys like me that have minimal knowledge of scripting it a challenge. Thanks in advance.[:)]
 
 
 
Hi Mark
I'm afraid that you are either are going to have to depend on 'handouts' from people like snippets of functional code you can insert as Slav has given you above OR learn a little about writing js script yourself.
There is a huge ammount about this available on the net or in books.

Nick
Subject:
Message options
No additional options