This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java(DATE)Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java(DATE)Validation" Watch "java(DATE)Validation" New topic


shabarish vai
Ranch Hand

Joined: May 26, 2008
Posts: 79
Date invalidDt = 2008/34/21;
String dateformat = "yyyyMMdd";
Date d=null;
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateformat);
} catch (Exception e) {
i got the output when i have "invalidDt" as String but i want "invalidDt" to be date as declared above.
please help.

Paul Fairhurst

Joined: Jun 12, 2008
Posts: 7
In Java, the compiler would really like to treat 2008/34/21 as a mathematical expression: 2008 divided by 34 divided by 21.

[ June 17, 2008: Message edited by: Paul Fairhurst ]

<a href="" target="_blank" rel="nofollow">infoQuanta</a> - parallel java programming made simple
I agree. Here's the link:
subject: java(DATE)Validation
It's not a secret anymore!