开发者

Creating Date from string (EEST format problem)

开发者 https://www.devze.com 2023-03-11 19:08 出处:网络
I have problem converting from string to date. The first one i Ok: Date d = new Date(\"Thu Jun 02 00:00:00 GMT+00:00 2011\");

I have problem converting from string to date.

The first one i Ok:

    Date d = new Date("Thu Jun 02 00:00:00 GMT+00:00 2011");

this one is fali(invalid argument):

    Date d1 = new Date("Mon Jun 06 00:00:00 EEST 2011");

Any suggestion? I need universal solution that will wor开发者_Python百科k with any format.


I think the next Q&A might solve your problem: Java - convert String (EEST included) into date

In short: you cannot use Date, but must use SimpleDateFormat.

0

精彩评论

暂无评论...
验证码 换一张
取 消