File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to get the date from the string representation of date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to get the date from the string representation of date" Watch "how to get the date from the string representation of date" New topic
Author

how to get the date from the string representation of date

neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
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
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

I think you need to use method :


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
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

Joined: Jan 08, 2009
Posts: 1447
    
    6

I think yes.


Swastik
subhash kumar
Ranch Hand

Joined: Jul 14, 2010
Posts: 63
If you want java.util.Date here is example:


and if the java.sql.Date


Subhash Kumar
Attitude is everything
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
thanks for the replies...am trying the ways suggested by you all to get my problem solved....
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
@ 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

Joined: Jul 03, 2010
Posts: 62
@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

Joined: Mar 04, 2009
Posts: 477
Neha:

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

Hope it would help!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37879
    
  22
Don't put such long lines inside code tags.
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
@Campbell Ritchie:Sorry..will take care from next time
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37879
    
  22
Apologies accepted. It's just that such long lines expand the window beyond the width of the screen and are difficult to read.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get the date from the string representation of date
 
Similar Threads
problem with JTable - while inserting JComboBox (DateComboBox)
Applying logic tags for DATE
Continously updated date field in GridBagLayout does not work
SimpleDateFormat problem....
Getting date format from Locale