File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the date from the string representation of date

 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,

i have a datecombobox named endDateCombo.....i have set the value of it by providing


now i am extracting the value from endDateCombo as:



Once i have done this i need to know a way so that am able to extract the Date and time from the above string specified so that i can typecast it to Timestamp and perform comparisons.

please help

thanks.
 
salvin francis
Bartender
Posts: 1204
9
Eclipse IDE Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to use method :
 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply...

you mean that i need to write the following statements to get the date and time from the string representation:


and once i get the date representation i'll write the following statement to get the timestamp:


please reply
thanks
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think yes.
 
subhash kumar
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want java.util.Date here is example:


and if the java.sql.Date
 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the replies...am trying the ways suggested by you all to get my problem solved....
 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ swastik dey:



i tried the way you suggested...

but am getting errors:



could anyone explain where exactly am going wrong with the parsing???
 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@subhash kumar:
thanks for your reply..
the imoprts in my application are:


and its giving the error which i have already posted in the previous post.
thanks
 
Somnath Mallick
Ranch Hand
Posts: 482
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neha:

Read this
http://www.roseindia.net/java/java-conversion/StringToDate.shtml

Hope it would help!
 
Campbell Ritchie
Sheriff
Pie
Posts: 47222
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't put such long lines inside code tags.
 
neha priya
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell Ritchie:Sorry..will take care from next time
 
Campbell Ritchie
Sheriff
Pie
Posts: 47222
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies accepted. It's just that such long lines expand the window beyond the width of the screen and are difficult to read.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic