Parsing Date Formats in Java

后端 未结 2 1638
有刺的猬
有刺的猬 2021-01-29 05:30

I\'m trying to convert Dates into Unix Timestamps in Java. Examples for my dates are: \"Fri Jun 05 15:53:07 PDT 2009\"

My code is:

DateFormat dateFormat          


        
2条回答
  •  佛祖请我去吃肉
    2021-01-29 05:39

    This is probably a Locale issue - Fri is friday in English but not in French or German for example:

    DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
    

提交回复
热议问题