• Post Reply Bookmark Topic Watch Topic
  • New Topic

YYYYMMDD HH:MM:SS.uuuuuu how to convert this type of date to datetime  RSS feed

 
jaspreet walia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am receiving th ebelow type of date from a file

20090812 20:19:02.894704 +0100s
i need to parse it and convert to datetime.
can any one help me on this.
simpleDateFormat does not accept this type of format.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jaspreet,
Try with this "yyyyMMdd HH:mm:ss.SSSSSS Z". There are many Date time formats like XMLGregorianCalendar. So its better to get what kind of Date format from the application owner who writes to the file.
 
jaspreet walia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this format allows me to parse but issue is it takes microsec as milii sec and convetrts them into minutes and sec altogether changing the date
 
Paul Clapham
Sheriff
Posts: 22708
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it does that. So truncate your string after three digits of milliseconds and parse that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!