Saturday 3 March 2012

Selenium IDE -Get Current Time, Date, Month and Year


Current Time - javascript{(new Date().getHours()+" : " + new Date().getMinutes() + " : " + new Date().getSeconds())}

Current year - javascript{(new Date()).getFullYear()}

Current Month - javascript{(new Date().getMonth()) + 1}

Current date - javascript{(new Date().getDate().toString())}

10 comments:

  1. How would I get AM/PM with the Current Time?

    ReplyDelete
  2. You can get current time by below code, m not sure about AM/PM
    store | javascript{(new Date().getHours()+" : " + new Date().getMinutes() + " : " + new Date().getSeconds())} | time
    echo | ${time}

    ReplyDelete
  3. where it show Time , I used same command but unable to see current time .....

    ReplyDelete
  4. what it is returning??are you getting javascript{(new Date().getHours()+" : " + new Date().getMinutes() + " : " + new Date().getSeconds())} as o/p??
    If yes, check for spacing at the end.

    ReplyDelete
  5. Hi all i need time like Tue 25 Sep 2012. could you please help me.

    ReplyDelete
  6. what is the code to get the one month later date in dd-mm-yyyy format.

    ReplyDelete
  7. convert datetime to 12 hours AM/PM format
    http://allinworld99.blogspot.in/2014/07/get-am-pm-from-datetime-javascript.html

    ReplyDelete
  8. Is there a way to get 24 hour time? i.e. 0600, 1425?

    ReplyDelete
  9. really I need YearMonthDayTime. What would I do to put that in Selenium IDE? Not javascript.

    ReplyDelete