The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

How to Convert String Date into Millseconds

In your project you have some date and as project requirement you want to convert it into milliseconds or while code you need to convert date into other format, I am same date in file saving, long date is used in file name but it use depend on the developer.


1) First convert string to java.Date using simpledateformatter
2) Use getTime method to obtain count of millisecs from date

public class test {
    public static void main(String[] args) {

         String currentDate = "01-March-2016";
         SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yyyy");
         Date parseDate = f.parse(currentDate);
         long milliseconds = parseDate.getTime();
    }
}

No comments

Post a Comment

Powered by Blogger.