Can anybody let me know about the date formats available in SimpleDateFormat class.
I have gone through api but could not find a satisfactory answer.Any help is highly appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Date and time formats are well described below
SimpleDateFormat (Java Platform SE 7) – Date and Time Patterns
There could be
nNumber of formats you can possibly make. ex –dd/MM/yyyyorYYYY-'W'ww-uor you can mix and match the letters to achieve your required pattern. Pattern letters are as follow.G– Era designator (AD)y– Year (1996; 96)Y– Week Year (2009; 09)M– Month in year (July; Jul; 07)w– Week in year (27)W– Week in month (2)D– Day in year (189)d– Day in month (10)F– Day of week in month (2)E– Day name in week (Tuesday; Tue)u– Day number of week (1 = Monday, …, 7 = Sunday)a– AM/PM markerH– Hour in day (0-23)k– Hour in day (1-24)K– Hour in am/pm (0-11)h– Hour in am/pm (1-12)m– Minute in hour (30)s– Second in minute (55)S– Millisecond (978)z– General time zone (Pacific Standard Time; PST; GMT-08:00)Z– RFC 822 time zone (-0800)X– ISO 8601 time zone (-08; -0800; -08:00)To parse:
Use:
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");