• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Date functions in java  RSS feed

 
Pravin Reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

I am trying to read a file where date is in the form of string like
23-MAR-2004.

I want to check whether the string i.e., 23-MAR-2004 is valid date or not .. and if it is valid date.... i need to store in a variable.

Is there any function to check whether it is valid date or not? if not, any other way?

Bye
Pravin
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just for you

http://www.rgagnon.com/javadetails/java-0099.html
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the SimpleDateFormat class & parse this string. if it's not a valid date in the specified format you get an exception.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!