18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Compare two dates in sahi
Hi,
for example , i need to validate the dates greater than this date(03/18/2011). i need to validate the dates less than this date(03/18/2011).
Is there any pre defined functions in Sahi to work with or can anyone suggest me how to validate this?
for example , i need to validate the dates greater than this date(03/18/2011). i need to validate the dates less than this date(03/18/2011).
Is there any pre defined functions in Sahi to work with or can anyone suggest me how to validate this?
Comments
you have to change to format of your date... either manually or automatic (maybe there's a javascript snipptet on the web), then u can use Date.parse() http://www.w3schools.com/jsref/jsref_parse.asp
Then you can compare the milliseconds returned by parse() to see if a date is above or below some other
Regards
Wormi
But i tried this.It wil work for JS, but not sahi. Is there any predefined function in sahi.
How to check whether the date (10/15/2011) is between the dates (7/15/2011) and (12/15/2011).
Please help me....
lOGIC is
your date:10/15/2011
Start date:7/15/2011
Enddate:12/15/2011
if yourdate> startdate and yourdate<Enddate // here and is logical and
Please try with above logic, it will works
alert("Date: "+Date.parse("01/01/2000")) works with sahi
so use ( Date.parse($yourdate) > Date.parse($startdate) ) && (Date.parse($youurdate) < Date.parse($enddate)) as mentioned by rajathummala