Here's the response that I got from Robert Mungo:
Hello:
Take a look at JavaDocs for the JDK. You can do this in a number of ways,
but the easiest is:
Start with java.util.Calendar.
Construct a Calendar for the default TimeZone:
Calendar cal = new Calendar();
Then set the Calendar to the day, month and year;
cal.set (year, month, day); // month is 0-based, Jan=0
To do this step, you need the day, month and year part of the date
that the user enters.
Then get a java.util.Date from the Calendar:
Date anyDate = cal.getTime();
Then use the DateFormat static method (getDateInstance()) and a
method it inherits (format()) to get a java String:
String anyString =
DateFormat.getDateInstance().format(anyDate);
Also, the DateFormat.getDateInstance() static method has a few signatures.
You can supply it with the
constant, SHORT, to get the format in the default Locale. For
internationalization provide a Locale to the method.
I don't understand the second part of your requirements - saving in format
"010100". I guess you could use a custom format to do this (look at
java.text.SimpleDateFormat or use Calendar.get(int datepart) to get day,
month and year to create your own String.
This is my recollection. Hope this helps!
Bob
"Rimma" <[EMAIL PROTECTED]> wrote:
>>Hello, Java gurus!
>
>I'm having a little problem with dates. In my application, a user enters a Date and
>then
>this Date is used for two purposes. First, the Date gets displayed on the next page
>in
>the format "January 1, 2000". Second, the final document gets saved by the Date in
>format "010100".
>
>I understand that I have to create an array to achieve this. However, I
>don't have a lot of experience with Java and right now I'm in trouble. Did anybody
>ever
>do something like this? Do you have ANY examples of code or any suggestions?
>
>Thanks a lot in advance,
>Rimma
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]