How can I do that? I tried a lot but it is not working properly.
public static String getDateTime() {
String dateStr = "";
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateStr = dateFormat.format(date);
return dateStr;
}
Please someone right another method which return miliseconds from above Date format. Of course! In my DB I'm storing this value: 2019-04-17 17:11:02 -> I want this value to convert in miliseconds using one method. so that I call new method and pass that variable value.