Year Variable

Hi,


Would anyone know how I can have only the current year showing in my wbt rather than the current date. The wbt I'm building requires that employees take the wbt every year and I would like to have in my heading Course Name - Year (ie. Building Widgets - 2013 and next year it would be Building Widgets - 2014, etc.)


Any ideas.


Thanks in advance.


Tmac

Discussion (6)

Add action -> execute JS -> VarYourVariable.set(new Date().getFullYear()). Sets your variable to the current year in 4-digit format. Then you can do what you want with it.

Awesome...thanks so much for the information.


Tmac

@ssneg 49412 wrote:

Add action -> execute JS -> VarYourVariable.set(new Date().getFullYear()). Sets your variable to the current year in 4-digit format. Then you can do what you want with it.


Is there a way to capture EPOCH time like this? I want to prevent users from accessing particular elements until after specific dates and using CurrentDate is proving impossible.

@NixTheNext 49509 wrote:

Is there a way to capture EPOCH time like this? I want to prevent users from accessing particular elements until after specific dates and using CurrentDate is proving impossible.


It's great to be a geek!


VarYourVariable.set(Math.round(new Date().getTime() / 1000)) = EPOCH in seconds.


Use http://www.epochconverter.com/ to determine EPOCH of a future time, establish custom variable representing future date's EPOCH time.


:D

Hi again,


I tried using the script but I'm at a total loss on the correct way of adding it. :o


I'm not much of a programmer and I really don't know what I'm doing....can anyone give me some direction....


Tmac

got it to work


Tmac

Discussions have been disabled for this post