1. Get the current month and day ... Methods of information
1 Public classCommondate {2 3 Public FinalString year =string.valueof (Calendar.getinstance (). Get (Calendar.year));4 Public FinalString month = string.valueof (Calendar.getinstance (). Get (Calendar.month) +1);5 Public FinalString Day =string.valueof (Calendar.getinstance (). Get (Calendar.day_of_month));6 Public FinalString hour_24 =string.valueof (Calendar.getinstance (). Get (Calendar.hour_of_day));7 Public FinalString Hour_12 =string.valueof (Calendar.getinstance (). Get (Calendar.hour));8 Public FinalString minute =string.valueof (Calendar.getinstance (). Get (Calendar.minute));9 Public FinalString second =string.valueof (Calendar.getinstance (). Get (Calendar.second));Ten Public FinalString week_of_year =string.valueof (Calendar.getinstance (). Get (Calendar.week_of_year)); One Public FinalString Week_of_month =string.valueof (Calendar.getinstance (). Get (Calendar.week_of_month)); A Public FinalString day_of_year =string.valueof (Calendar.getinstance (). Get (Calendar.day_of_year)); - Public FinalString Day_of_month =string.valueof (Calendar.getinstance (). Get (Calendar.day_of_month)); - Public FinalString Day_of_week =string.valueof (Calendar.getinstance (). Get (Calendar.day_of_week)); the - - - /** + * Get current time - * @returncurrent time, 24 hours yyyy-mm-dd HH:mm:ss format + */ A PublicString GetTime24 () { atDate Date =NewDate (); -SimpleDateFormat TimeStamp =NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss"); -String time =Timestamp.format (date); - returnTime ; -}
View Code2. Obtain the requested IP address
3, because the database is the time format, so to get the format of seconds and minutes4, Spring.xml file for the object to pass the list format data
Get Current Month day ... Information about the method that gets the requested IP address, because the database is in time format, so to get the format of seconds and minutes