Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get the date from the string representation of date  RSS feed

 
neha priya
Ranch Hand
Posts: 62
  • 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: 1538
26
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to use method :
 
neha priya
Ranch Hand
Posts: 62
  • 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: 1784
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think yes.
 
subhash kumar
Ranch Hand
Posts: 63
  • 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
  • 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
  • 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
  • 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: 483
  • 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
Marshal
Posts: 54878
155
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell Ritchie:Sorry..will take care from next time
 
Campbell Ritchie
Marshal
Posts: 54878
155
  • 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.
 
You don't like waffles? Well, do you like this tiny ad?
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!