How i can convert a date object into a calender object
Possible Duplicate:
Date object to Calendar [Java]
I have a Java Date object like
Date A = Mon Nov 07 00:00:00 CET 2011;
I want to get the year ,month and day. But i saw like these getYear ,getMonth and getDay is deprecated. So how can i extract the above from the above date object.
您可以使用Calendar.setTime()
。
尝试以下操作:
Date a = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(a);
尝试这样的事情:
Date d = new Date();
Calendar c = Calendar.getInstance();
c.setTime(d);
链接地址: http://www.djcxy.com/p/36718.html
上一篇: 两个Date()在几个月内的JavaScript差异
下一篇: 我如何将日期对象转换为日历对象