Year Variable

tmac2010
tmac2010 Community Member Posts: 32
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

Comments

  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    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.
  • tmac2010
    tmac2010 Community Member Posts: 32
    Awesome...thanks so much for the information.



    Tmac
  • nixthenext
    nixthenext Community Member Posts: 75
    @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
    nixthenext Community Member Posts: 75
    @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
  • tmac2010
    tmac2010 Community Member Posts: 32
    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
  • tmac2010
    tmac2010 Community Member Posts: 32
    got it to work



    Tmac