Results 1 to 6 of 6
- 12-21-2011, 09:10 AM #1
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
String to date conversion issue...
Hi,
I am trying to convert the string date to actual date using SimpleDateFormat class. But it seems the SimpleDateFormat class is returning the invalid value for the date object. It is increasing the minute value by 1. I am not sure if it's an actual issue with SimpleDateFormat class or my way of conversion is wrong. Any Help is really appreciated.
The code :
Thanks in advance.Java Code:SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.ms'Z'"); Date date = dateFormat.parse("2011-12-20T15:08:14.917Z"); System.out.println("Date: " + date); It is displaying "Tue Dec 20 15:09:17 IST 2011" instead of "Tue Dec 20 15:08:14 IST 2011".
- 12-21-2011, 09:56 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
Re: String to date conversion issue...
Does that happen consistently or did it only happen once?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 12-21-2011, 09:59 AM #3
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Re: String to date conversion issue...
Hi Jos,
It's happening every time. Any idea why ?
Thanks.
- 12-21-2011, 10:52 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,537
- Rep Power
- 11
Re: String to date conversion issue...
It parses the .ms at the end as 9:17
- 12-21-2011, 11:25 AM #5
Member
- Join Date
- Dec 2011
- Posts
- 3
- Rep Power
- 0
Re: String to date conversion issue...
any other way or method which gives me proper date ?
- 12-21-2011, 11:28 AM #6
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,537
- Rep Power
- 11
Similar Threads
-
string date to formatted date string
By reach2sudhakar in forum New To JavaReplies: 4Last Post: 06-20-2011, 10:06 AM -
String to date conversion
By nn12 in forum New To JavaReplies: 4Last Post: 11-04-2010, 07:59 AM -
converting string (GMT date) to date in US time.
By JRuyechan in forum New To JavaReplies: 1Last Post: 10-15-2010, 07:07 AM -
convert String date to Date
By computerbum in forum New To JavaReplies: 7Last Post: 09-18-2010, 03:26 PM -
String to Date conversion
By javaplus in forum New To JavaReplies: 2Last Post: 11-06-2007, 07:16 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks