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.
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.