समझ में नहीं आता क्यों निम्नलिखित जगह लेता है:Date.getTime() समय सहित नहीं?
String date = "06-04-2007 07:05";
SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm");
Date myDate = fmt.parse(date);
System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007
long timestamp = myDate.getTime();
System.out.println(timestamp); //1180955100000 -- where are the milliseconds?
// on the other hand...
myDate = new Date();
System.out.println(myDate); //Tue Sep 16 13:02:44 EDT 2008
timestamp = myDate.getTime();
System.out.println(timestamp); //1221584564703 -- why, oh, why?
कोई सेकंड नहीं है, क्योंकि आपने तिथि में कोई भी नहीं दिया है! –
उहम, मैं उन्हें वहां देखता हूं, अंतिम तीन 0 है। आपने उन्हें 0 पर सेट कर दिया है। –