• 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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: 22831
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!