hi, i am trying to figure out if the time has been set in the calendar. isSet returns true if the hour is 0 assuming it is midnight. so when does it return false. ----------------------------------------------------------- Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Date d = sdf.parse("20010909", new ParsePosition(0)); System.out.println("t/f " + c.isSet(Calendar.HOUR) ); ----------------------------------------------------------- the above returns true because the hour is 0. so when will it return false???
John Faulk
Greenhorn
Joined: Feb 05, 2001
Posts: 4
posted
0
yes i did do a c.setTime(d); after getting Date d.
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
Per the API
isSet() The flags which tell if a specified time field for the calendar is set. A new object has no fields set. After the first call to a method which generates the fields, they all remain set after that. This is an array of FIELD_COUNT booleans, with index values ERA through DST_OFFSET.
"JavaRanch, where the deer and the Certified play" - David O'Meara