How to get Month, Day and Year in Selenium Java WebDriver

Sample Code:

    int day, month, year;
    int secnd, minute, hour;
    GregorianCalendar date = new GregorianCalendar();

    day = date.get(Calendar.DAY_OF_MONTH);
    month = date.get(Calendar.MONTH);
    year = date.get(Calendar.YEAR);

    secnd = date.get(Calendar.SECOND);
    minute = date.get(Calendar.MINUTE);
    hour = date.get(Calendar.HOUR);

    String todayDate = String.valueOf(month) + '/' + String.valueOf(day) + '/' + String.valueOf(year);


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit