开发者

Java - convert String (EEST included) into date

I'm having this kind of String:

Wed Oct 27 00:00:00 EEST 2010

and I want to parse this into type Date.

I've tried with

DateTimeFormat fmt = DateTimeFormat.getFormat(开发者_StackOverflow"EEE MMM dd HH:mm:ss zzzz yyyy");

but it doesn't work.

Need help in getting this fixed. Thanks.


Try using simple date format. Here is an example.. SimpleDateFormat java docs...

String dt = "Wed Oct 27 00:00:00 EEST 2010";
SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy");
Date date = format.parse(dt);
System.out.println("date = " + date);


Thanks guys,

I need to use DateTimeFormat because with SimpleDateFormat it doesn't work because I'm using GWT.

I'm running my project with GWT plugin from IntellijIdea and there I have this 2 errors if I'm using SimpleDateFormat:

[ERROR] Line 164: SimpleDateFormat cannot be resolved to a type
[ERROR] Line 167: ParseException cannot be resolved to a type
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜