This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

time stamp question

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can I send time stamp in 'ddmmyyyyhhss' format across the wire(like a post or get parameter) and retrieve as a string and compare with time on the other side. Is it possible to recreate date from the above string?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, it's possible.

You can use java.text.DateFormat
[ October 14, 2004: Message edited by: somkiat puisungnoen ]
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but if i use, simpledateformat("the string i got over the wire") it gives unparsable content error.

The string can be seen as like "10/15/2004 03:08:51 AM" and my code is below:
Date userDate = new SimpleDateFormat().parse(timeStamp);

Any thoughts???
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kishore Dandu:
but if i use, simpledateformat("the string i got over the wire") it gives unparsable content error.

The string can be seen as like "10/15/2004 03:08:51 AM" and my code is below:
Date userDate = new SimpleDateFormat().parse(timeStamp);

Any thoughts???


I can parse "10/15/2004 03:08:51".

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks it works now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic