get(Calendar.DAY_OF_WEEK): returns 1 ( Calendar.SUNDAY) to 7 ( Calendar.SATURDAY).The calendarField are defined as static constant and includes: The most important method in Calendar is get(int calendarField), which produces an int. Looking into the source code reveals that: getInstance() returns a GregorianCalendar instance for all locales, (except BuddhistCalendar for Thai (" th_TH") and JapaneseImperialCalendar for Japanese (" ja_JP")). Calendar.getInstance(TimeZone zone, Locale aLocale).Calendar.getInstance(): return a Calendar instance based on the current time in the default time zone with the default locale.Instead, you use the static method Calendar.getInstance() to instantiate an implementation sub-class. manipulating these calendar fields, such as getting the date of the previous week, roll forward by 3 days.Ĭalendar provides internationalization support.Ĭalendar is a abstract class, and you cannot use the constructor to create an instance.maintaining a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, MINUTE, SECOND, MILLISECOND and.Calendar and DateFormat support locale (you need to consider locale only if you program is to be run in many countries concurrently). SimpleDateForamt is a subclass of DateFormat.ĭate is legacy class, which does not support internationalization. Use to format a Date (form Date to text) and parse a date string (from text to Date). ![]() Use class if you need to extract year, month, day, hour, minute, and second, or manipulating these field (e.g., 7 days later, 3 weeks earlier). You could use SimpleDateFormat to control the date/time display format. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |