The below code gives me current time. but it does not tell anything about millisecond
public static String getCurrentTimeStamp() {
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return strDate;
}
I get date in the format 2009-09-22 16:47:08 (YYYY-MM-DD HH:MI:Sec)
But I want to retrieve current time in the format 2009-09-22 16:47:08.128 ((YYYY-MM-DD HH:MI:Sec.Ms)
where 128 tells the millisecond.
SimpleTextFormat will work fine. Here the lowest unit of time is second. but I want millisecond also.