java中DateFormat类中有个Calendar getCalendar()这个方法是什么意思,怎么获得当前日历。
答案:5 悬赏:0
解决时间 2021-03-24 10:29
- 提问者网友:小姐请专情
- 2021-03-23 17:31
能给个简单例子,谢谢!没钱悬赏了,还希望前辈们多多指教。
最佳答案
- 二级知识专家网友:一只傻青衣
- 2021-03-23 18:12
calendar.date是个int类型的常量
public final static int date = 5;
calendar.get(int field)是根据calendar的字段获取相应的值。你这个是获取calendar中年月日中的“日”
public final static int date = 5;
calendar.get(int field)是根据calendar的字段获取相应的值。你这个是获取calendar中年月日中的“日”
全部回答
- 1楼网友:嗷呜我不好爱
- 2021-03-23 23:04
看API....
- 2楼网友:安稳不如野
- 2021-03-23 21:49
~~~~~~~~~~`
- 3楼网友:糜废丧逼
- 2021-03-23 20:13
public class MyDate{
int theyear=0;
int themonth=0;
int theday=0;
String thedate=null;
public String getDate(){
Calendar calendar=Calendar.getInstance();
theyear= calendar.get(Calendar.YEAR);
themonth=calendar.get(Calendar.MONTH)+1;
theday=calendar.get(Calendar.DAY_OF_MONTH);
thedate=""+theyear+"年"+themonth+"月"+theday+"日";
return thedate;
}
}
- 4楼网友:冷态度
- 2021-03-23 19:31
你多看看网上的例子哦。看看API 都是前人总结的。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |