android - Converting strings to date and time and extract year, month, day, day of week, hour and minutes -
I am retrieving JSN objects on my Android app. They have two fields: fields are How can I do this? A class is SimpleDateFormat that parses the date and when you specify Here is an example of your problems: Where string is the string result of your json date and
time . On Layout, I need to remove the following string from these two fields:
date = "2014-04-21",
time = "17:35:00"
string string = "2014-04-21 17:35:00"; Calendar calendar = calendar.justinstance (); Calender.setTime (new Simple Format ("yyyy-MM-d k: m: s"). Pars (string)); System.out.println ("Day of the week:" + calendar.get (Calendar. DAY_OF_WEEK)); // 2 Monday System.out.println ("Day of the month:" + Calendar.Gate (Calendar DAY_OF_MONTH)); System.out.println ("Month:" + calendar.get (calendar. MONTH); // January 3 is april System.out.println ("year:" + calender.get (calendar.IEER)); System.out.println ("Hour:" + Calendar.Gate (calendar.HOUR_OF_DAY)); System.out.println ("min:" + calender.get (calendar.mind.tv);
Comments
Post a Comment