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

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
H
Heimdal Security Blog
Help Net Security
Help Net Security
T
Troy Hunt's Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
N
News | PayPal Newsroom
TaoSecurity Blog
TaoSecurity Blog
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
G
GRAHAM CLULEY
S
Security @ Cisco Blogs
The Hacker News
The Hacker News
SecWiki News
SecWiki News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
A
Arctic Wolf
S
Securelist
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
Webroot Blog
Webroot Blog
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
Latest news
Latest news
T
Threatpost
K
Kaspersky official blog
Know Your Adversary
Know Your Adversary
Schneier on Security
Schneier on Security
I
Intezer
PCI Perspectives
PCI Perspectives
S
Security Affairs
爱范儿
爱范儿
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - 福娃

Ubuntu 16.04 LTS更新 程序员如何走出迷茫的困境? PHP vs Python Apache2.4中开通HTTP基本认证 NPM 与 left-pad 事件:我们是不是早已忘记该如何好好地编程? Groovy split竖杆注意 使用Flask-Migrate进行管理数据库升级 Fabric自动部署太方便了 程序员的复仇:11行代码如何让Node.js社区鸡飞狗跳 CAS认证原理图 grails 私有库相关设置 A successful Git branching model IBatis.Net如何支持多个数据库 [django]the story about Django and TurboGears [django]newforms两种方式示例 Since NHibernate 1.2.0, objects are lazy by default - 福娃 [Castle]Castle.Model被Castle.Core代替了 [Castle]Castle也范型 - 福娃 - 博客园 [Castle]Asp.Net中获取Castle容器中的服务的另一方法
String to Date 多种格式转换
福娃 · 2015-12-24 · via 博客园 - 福娃

在做Excel数据导入的时候,有些日期文本转换为日期格式时,需要适应多种格式,转换代码如下:

static Date multiParse(String strDate){

    if (strDate?.trim()){
        final List<String> dateFormats = Arrays.asList("yyyy-MM-dd", "yyyy/MM/dd");    

        for(String format: dateFormats){
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            try{
                return sdf.parse(strDate);
            } catch (ParseException e) {
                 //intentionally empty
            }
        }
    }
    return null
}