如何转换以下字符串Date对象? [英] How to Convert the Following string into Date Object?
本文介绍了如何转换以下字符串Date对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的Android Development.How以下字符串(5/31/2011)转换到Date对象我尝试不同的方法,但不能得到任何运气?
解决方案
字符串dateStr =5/31/2011
日期格式DF =新的SimpleDateFormat(M / DD / YYYY);
日期日期= df.parse(dateStr);
I am New to Android Development.How to convert the Following string(5/31/2011) in to the Date Object I tried different ways But Couldn't get any Luck??
解决方案
String dateStr = "5/31/2011";
DateFormat df = new SimpleDateFormat("M/dd/yyyy");
Date date = df.parse(dateStr);
这篇关于如何转换以下字符串Date对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文