• Post Reply Bookmark Topic Watch Topic
  • New Topic

can not import java.util.regex  RSS feed

 
elli dian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to validate a date,according format dd-mm-yyyy
But I can't import java.util.regex.
Please help me, so I can import the package.
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of the JDK you are using? The regex classes are available in JDK 1.4 or higher.
 
elli dian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How I can validate a date if I don�t using JDK 1.4 or higher?
Thank you.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can construct a java.text.SimpleDateFormat object for that pattern. If its parse method does not throw an exception, then it's a valid date.
 
elli dian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The date is parameter form user. So I mean Iwant to check that the user don�t input any character to the parameter. Form example if the parameter is: er-05-2006 the return is false, but if the parameter is a valid date(03-05-2006) return is true.
Thank you.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try those examples using the approach I suggested?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!