惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
雷峰网
雷峰网
S
Securelist
V
Vulnerabilities – Threatpost
S
SegmentFault 最新的问题
T
The Exploit Database - CXSecurity.com
A
About on SuperTechFans
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
L
Lohrmann on Cybersecurity
S
Security Affairs
S
Secure Thoughts
P
Privacy & Cybersecurity Law Blog
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
H
Heimdal Security Blog
L
LINUX DO - 热门话题
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
D
DataBreaches.Net
N
Netflix TechBlog - Medium
The Hacker News
The Hacker News
N
News and Events Feed by Topic
C
Check Point Blog
博客园_首页
Scott Helme
Scott Helme
T
Troy Hunt's Blog
U
Unit 42

博客园 - 在下刚哥

ABP配置时间格式 List与String、数组的相互转换 Json转换 黑龙江社保电话 List与String的相互转换(C#) ServiceStack.Redis的GetTypedClient C# 16进制转换10进制 揭秘人体24小时 四年一轮回 .cs编译DLL类库方法 类命名规范、数据库命名规范和页面文件命名规范 SHTML和HTML的区别 NavigateUrl属性绑定 - 在下刚哥 - 博客园 让IT工作者过劳的13个坏习惯 腾讯笔试题--国王招来100个囚犯(转) 很牛的求职经历(转) 中国各城市经纬度数据 Microsoft Visual Source Safe 2005 下载地址 Fckeditor在.net下用验证控件问题
Java Instant\Date\LocalDateTime\Calendar\ZonedDateTime转化 - 在下刚哥 - 博客园
在下刚哥 · 2022-06-27 · via 博客园 - 在下刚哥
public static Instant toInstant(Date date) {
return Instant.ofEpochMilli(date.getTime());
}
public static Date toDate(Instant instant) {
return new Date(instant.toEpochMilli());
}
public static Date toDate(LocalDateTime ldt) {
return new Date(ldt.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
}
public static Calendar toCalendar(ZonedDateTime zdt) {
TimeZone tz = TimeZone.getTimeZone(zdt.getZone());
Calendar calendar = Calendar.getInstance(tz);
calendar.setTimeInMillis(zdt.toInstant().toEpochMilli());
return calendar;
}

public static LocalDateTime toLocalDateTime(Date date) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
}

public static ZonedDateTime toZonedDateTime(Calendar calendar) {
ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(calendar.getTimeInMillis()), calendar.getTimeZone().toZoneId());
return zdt;
}