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

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
Project Zero
Project Zero
Google Online Security Blog
Google Online Security Blog
The Cloudflare Blog
L
LangChain Blog
T
Tenable Blog
GbyAI
GbyAI
C
Cybersecurity and Infrastructure Security Agency CISA
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
量子位
Cloudbric
Cloudbric
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
S
Secure Thoughts
P
Privacy & Cybersecurity Law Blog
S
Securelist
S
Schneier on Security
F
Full Disclosure
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
宝玉的分享
宝玉的分享
A
About on SuperTechFans
博客园 - 【当耐特】
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Heimdal Security Blog
Y
Y Combinator Blog
月光博客
月光博客
H
Hacker News: Front Page
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
N
Netflix TechBlog - Medium

博客园 - 福娃

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
}