converting String to Calendar. What is the easiest way?(将字符串转换为日历.最简单的方法是什么?)
问题描述
将格式化的字符串转换为日历的最简单和最简单的方法是什么?例如 'dd.MM.yyyy' 到日历?
What is the simplest and easiest way to convert formatted String to Calendar? For example 'dd.MM.yyyy' to Calendar?
推荐答案
DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
Calendar cal = Calendar.getInstance();
cal.setTime(df.parse(stringInstanceRepresentingDate));
这篇关于将字符串转换为日历.最简单的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!