how to get the text by using (string ex days) converting get text

String startDate = “05052015_5110076629″;
String exDays=”273”;

String[] parts = startDate.split(“_”);
String part1 = parts[0];
String dd = part1.substring(0, 2);
String mm = part1.substring(2, 4);
String yy = part1.substring(4);

System.out.println(“dd : “+dd);
System.out.println(“mm : “+mm);
System.out.println(“yy : “+yy);

Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat(“ddMMyyyy”);
String endDate = dateFormat.format(date);
String dd1 = endDate.substring(0, 2);
String mm1 = endDate.substring(2, 4);
String yy1 = endDate.substring(4);
System.out.println(“dd1 : “+dd1);
System.out.println(“mm1 : “+mm1);
System.out.println(“yy1 : “+yy1);
Date startdate = new GregorianCalendar(Integer.parseInt(yy), Integer.parseInt(mm), Integer.parseInt(dd), 23, 59).getTime();
Date enddate = new GregorianCalendar(Integer.parseInt(yy1), Integer.parseInt(mm1), Integer.parseInt(dd1), 23, 59).getTime();
long diff=enddate.getTime()-startdate.getTime();
long days=diff / (24 * 60 * 60 * 1000);
System.out.println(“days:”+days );

String outDays = String.valueOf(days);

System.out.println(“string Days is ” + outDays);

if(outDays.equals(exDays)){
System.out.println(“Pass”);
} else {
System.out.println(“Fail”);
}
return status;
}

}

Default Asked on February 9, 2016 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.