Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getMonth(String date) throws ParseException {
- Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(date);
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- String monthName = new SimpleDateFormat("MMM").format(cal.getTime());
- return monthName;
- }
- private String getDate(String date) throws ParseException{
- Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(date);
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- String dateName = new SimpleDateFormat("dd").format(cal.getTime());
- return dateName;
- }
- private String getYear(String date) throws ParseException{
- Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(date);
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- String yearName = new SimpleDateFormat("yyyy").format(cal.getTime());
- return yearName;
- }
- private String getTime(String date) throws ParseException{
- Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(date);
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- String timeName = new SimpleDateFormat("hh:mm a").format(cal.getTime());
- return timeName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement