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 Android Security Essentials Live Lessons this week in the Android 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="http://www.infoQuanta.com" target="_blank" rel="nofollow">infoQuanta</a> - parallel java programming made simple
I agree. Here's the link: http://aspose.com/file-tools
subject: java(DATE)Validation
Similar Threads
convert timestamp to date
Date format question
Grouse about Calendar, DateFormat, Date
How to print default date in required format
Date format