Skip to main content
Known Participant
March 21, 2018
Question

Creating a Past Date

  • March 21, 2018
  • 1 reply
  • 187 views

Hello Everyone,

I am trying to create a variable to display a past date.  In the scenario, we use the date from "two weeks ago." How can I create this to show today's date minus 14 days?

Using Captivate 2017

Thank you for your help

    This topic has been closed for replies.

    1 reply

    TLCMediaDesign
    Inspiring
    March 21, 2018

    What format do you want.

    This JS displays a full date:

    var d = new Date();

    var t = d.getTime();

    var nd = new Date(t - 1209600000);

    so if you have a variable in Captivate call pastDate, execute this JS

    var d = new Date();

    var t = d.getTime();

    window.pastDate = new Date(t - 1209600000);

    Kelli26Author
    Known Participant
    March 21, 2018

    Thank you - I will try it