当前位置:网站首页>Calendar日历类
Calendar日历类
2022-07-23 12:04:00 【杀手不太冷!】
Calendar日历类
初始化
Calendar日历类是初始化对象用的是Calendar.getInstance()方法,如下图:

Calendar日历中的Day,Year,Day_Of_Year等属性
如果我们想要得到一个日期对应的是第几年,或者这个日期对应的是一年中的第几天,或者是一年中的第几周,或者是一个月中的第几天,我们都可以直接使用Calendar对象的get方法进行获取,如下图:

Calendar类中有很多属性,如下图:

Calendar主动设置日期
Calendar有很多set重载函数,设置日期的时候可以只设置年月日如下图:

也可以设置年月日时分秒,如下图:

但是需要注意的是,我们的月份计算的时候是从0进行计算的,也就是说我们如果想要设置1月的时间,我们把month这个参数设置为0,如下图:
Calendar类型和Date类型的转换
Date类型如何转换为Calendar类型?

Calendar类型转换为Date类型?

边栏推荐
- Pydensecrf installation
- 信箱通信-
- Please initialize the log4j system properly.
- W3C introduces decentralized identifier as web standard
- CS5363,CS5350,CS5328几款太阳能板电池充电管理IC的功能特性与参数对比
- 2022 blue hat cup preliminary WP
- "1+1 > 10": potential combination of no code / low code and RPA Technology
- Middle aged crisis, retired at the age of 35, what do migrant workers take to compete with capitalists?
- Design idea of initializing page input parameters
- 忘记oracle密码,如何解决
猜你喜欢

满足多种按键的高性价比、高抗干扰触摸IC:VK3606D、VK3610I、VK3618I 具有高电源电压抑制比

2022 blue hat cup preliminary WP

中年危机,35岁被退休,打工人拿什么来抗衡资本家?

The difference between deadlock, hunger and dead cycle

Mysql—六大日志

FPGA HLS multiplier (pipeline vs. ordinary simulation)
![[attack and defense world web] difficulty Samsung 9 points introductory question (Part 2): shrink, lottery](/img/05/06dd9f071fe18e4a50d767ec51e557.png)
[attack and defense world web] difficulty Samsung 9 points introductory question (Part 2): shrink, lottery

黑马程序员-接口测试-四天学习接口测试-第三天-postman高级用法,newman例集导出导入,常用断言,断言json数据,工作原理,全局,环境变量,时间戳,请求前置脚本,关联,批量执行测试用例

Vinka推出高抗干扰VK36N系列触摸IC:VK36N1D,VK36N2P,VK36N3B,VK36N4I 使用便利

Kubernetes 基本概念和部署
随机推荐
Without Huawei, Qualcomm will raise prices at will, and domestic mobile phones that lack core technology can only be slaughtered
冒泡排序-看着一篇就够啦
数字化转型时代的企业数据新基建 | 爱分析报告
MySQL表字段数量限制以及行大小限制
Bean Validation核心組件篇----04
Redis master-slave replication
Vinka introduces high anti-interference vk36n series touch IC: vk36n1d, vk36n2p, vk36n3b, vk36n4i, easy to use
[attack and defense world web] difficulty Samsung 9 points introductory question (Part 1): simple_ js、mfw
Of the 24 almost inevitable JVM interview questions, I only know 7. How many can you answer?
FMDB的封装与使用
WSAStartup函数的用途
New infrastructure of enterprise data in the era of digital transformation | love Analysis Report
Umijs - data transmission between main and sub applications of Qiankun
Please initialize the log4j system properly.
From the big guy baptism! 2022 headline first hand play MySQL advanced notes, and it is expected to penetrate P7
MySQL string sorted by numeric value
pgsql误删除pg_wal文件后,服务启动失败
Alamofire 框架封装与使用
nport串口服务器原理,MOXA串口服务器NPORT-5130详细配置
CA数字证书