I'm working with a database that is only running Java version 1.1 so it does not have access to any of the new date classes such as DateFormat etc...
I want to parse strings to get out date values so the only way I see of doing it on this version is by using Date.parse() as follows
Date d = new Date(Date.parse(st.nextToken()));
but my date is formatted like the following
Mon Sep 01 00:00:00 GMT 2009
What do I need to do, using this version, so that my dates are represented like '01/09/2009' or simply '01-SEP-2009'?
Also, if I pass in a date like '05/06/09' it reads it in as the first 2 figures being the month and not the year. How do I correct this?
Joined: Apr 04, 2009
To expand on my first question question...I have found a way to format the date as a string they way I want as follows
System.out.println(String.format("%td/%<tm/%<ty", new Date()));
However, is there a way to create and store the date reference in this format, so that if I have an arrayList of dates that they can be stored that way?
Something doesn't make sense here. If you can use "String.format(...)" then you're using at least Java 1.5, as that's when the format() method was first added to Java. Not to mention the fact that DateFormat and SimpleDateFormat have been in Java since it was first produced, so there's no reason you can't use them in any Java program at all.
And when you refer to a "database running Java version 1.1" exactly what does that mean? Most databases don't run Java in any way at all. Could you give us some more details about that, like the name of the database?
Sorry, I cannot use String.format... I was trying String.format in my latest version of Java.
What I need is something like that but for version 1.1 and yes, I am using Oracle 8 and that is why I only have 1.1 at my disposal. I've loaded in a java class and I want to perform some date formatting in its static method.