long time = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm:ss:ms");
java.util.Date resultdate = new java.util.Date(time);
//java.util.Date resultdate1 = sdf.format(time); //returns String I want Date.
// java.util.Date resultdate = sdf.parse(Long.toString(time)); //gives Exception
System.out.println(sdf.format(resultdate));
Prints--Jan 11,2011 11:54:40:5440
I am confused that 999 is the max value for millisecond and value greter than this converts into seconds,then why is it showing 5440 ?
also I want to format "resultdate" into Date again. convering long to String and then formatting It ,is giving format exception
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm:ss:ms");
java.util.Date resultdate = new java.util.Date(time);
//java.util.Date resultdate1 = sdf.format(time); //returns String I want Date.
// java.util.Date resultdate = sdf.parse(Long.toString(time)); //gives Exception
System.out.println(sdf.format(resultdate));
Prints--Jan 11,2011 11:54:40:5440
I am confused that 999 is the max value for millisecond and value greter than this converts into seconds,then why is it showing 5440 ?
also I want to format "resultdate" into Date again. convering long to String and then formatting It ,is giving format exception