• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Date validation. HELP!!  RSS feed

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the way to validate a date? Java seems to be treating 32nd Jan as 1st Feb. How can I catch a wrong day/month?
Thanks in advance.
 
Trailboss
Posts: 22859
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay, I have some classes I could post that should solve your problem.
I have a class called JDate and GDate (for julian and gregorian formats respectively. Put your date into the GDate type and then pass it to JDate.isValid(). JDate has gregorian to julian conversion stuff built in so it was a snap to add the test.
If this code will be of help to you, let me know and I'll post it here on the ranch.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul thanks...
i did some research though and found that the solution is simple. the setLenient method of the dateformat and calendar classes serves the purpose easily.
thanks again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!