当前位置:网站首页>Simpledateformat concrete classes for formatting and parsing dates
Simpledateformat concrete classes for formatting and parsing dates
2022-06-24 23:22:00 【Programmer Jiuan】
SimpleDateFormat Specific classes for formatting and parsing dates

SimpleDateFormat sdf = new SimpleDateFormat("yyyy year MM month dd Japan HH when mm branch ss second ");
Date to string
y Represents the year M Representative month d On behalf of the day E On behalf of the week H representative 24 Decimal hours h representative 12 Decimal hours
m For minutes s On behalf of the second ( uppercase )S On behalf of ms
// Format date as text
String format = sdf.format(date);
System.out.println(format);//2021 year 05 month 26 Japan 16 when 23 branch 01 second
// Parse the string to Date Time
Date parse = sdf.parse("2021 year 05 month 26 Japan 16 when 07 branch 25 second ");
System.out.println(parse);//Wed May 26 16:07:25 CST 2021

Date date1 = new Date();
// Judge whether the current time is between or after the set time
boolean after = date1.after(parse);
System.out.println(" Current time is after the set time :"+after);
boolean before = date1.before(parse);
System.out.println(" The current time is before the set time :"+before);
边栏推荐
- R语言使用MatchIt包进行倾向性匹配分析、使用match.data函数构建匹配后的样本集合、通过双样本t检验分析(双独立样本t检验)来判断倾向性评分匹配后样本中的所有协变量的平衡情况
- Écoutez le fichier markdown et mettez à jour Hot next. Page JS
- idea创建模块提示已存在
- OpenSSL SSL_ read: Connection was reset, errno 10054
- Collation of Digital IC design experience (II)
- [ROS play with turtle turtle]
- EMI的主要原因-工模电流
- Epics record reference 4 -- fields for all input records and fields for all output records
- Tech talk activity review kubernetes skills of cloud native Devops
- 【js】-【数组应用】-学习笔记
猜你喜欢

Theoretical analysis of countermeasure training: adaptive step size fast countermeasure training

Dig deep into MySQL - resolve the non clustered index of MyISAM storage engine
![[JS] - [array, stack, queue, linked list basics] - Notes](/img/c6/a1bd3b8ef6476d7d549abcb442949a.png)
[JS] - [array, stack, queue, linked list basics] - Notes

Chapter VI skills related to e-learning 5 (super parameter verification)

Blogs personal blog test point (manual test)

伪原创智能改写api百度-收录良好

【UVM入门 ===> Episode_8 】~ Sequence 和 Sequencer、Sequence 层次化
Paddledtx v1.0 has been released, and its security and flexibility have been comprehensively improved!

案例解析:用「度量」提升企业研发效能|ONES Talk
15 lines of code using mathematical formulas in wangeditor V5
随机推荐
常用正则表达式
Uip1.0 active sending problem understanding
Force deduction solution summary 515- find the maximum value in each tree row
R语言使用epiDisplay包的aggregate函数将数值变量基于因子变量拆分为不同的子集,计算每个子集的汇总统计信息、自定义FUN参数为多个统计量函数名称的列表计算多个统计量
The large-scale market of graduate dormitory! Here comes the enviable graduate dormitory!
Financial management [6]
案例解析:用「度量」提升企业研发效能|ONES Talk
Selection (026) - what is the output of the following code?
laravel学习笔记
推送Markdown格式信息到钉钉机器人
InnoDB, the storage engine of MySQL Architecture Principle_ Redo log and binlog
Docker-mysql8-master-slave
Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧
【js】-【树】-学习笔记
laravel 宝塔安全配置
Building Survey [1]
Selection (027) - what is the output of the following code?
golang convert json string to map
记录一下MySql update会锁定哪些范围的数据
SimpleDateFormat 格式化和解析日期的具体类