美文网首页技术干货
SimpleDateFormat 、Date 、calendar

SimpleDateFormat 、Date 、calendar

作者: 我和程序猿的日常 | 来源:发表于2017-04-25 16:38 被阅读0次
SimpleDateFormat dateFormatValue = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                    Date parseDate = null;
                    try {
                        parseDate = dateFormatValue.parse(value);
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    calendar.setTime(parseDate);
                    thisYear = calendar.get(Calendar.YEAR);
                    thisMonthOfYear = calendar.get(Calendar.MONTH);
                    thisDayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
                    thisHours = calendar.get(Calendar.HOUR_OF_DAY);
                    thisMin = calendar.get(Calendar.MINUTE);

相关文章

网友评论

    本文标题:SimpleDateFormat 、Date 、calendar

    本文链接:https://www.haomeiwen.com/subject/uegcattx.html