pro_java thread: Help with date format...
You may want to use the SimpleDateFormat class. In the following snippet, a
date value from a GUI control is converted to a string. So the date input
in my case is the value of "FromDateField.getDate()" -- but could be any
date field. The date output in my case is the string "workFromDateString".
The "formatter" object is what controls the appearance of the date output.
You may need to review the docs for the SimpleDateFormat class to see what
values can be used where I used "yyyyMMdd".
// Get attendance "from" date in YYYYMMDD format:
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
java.util.Date workDate = FromDateField.getDate();
String workFromDateString = formatter.format(workDate);
Hope that helps.
Steve
----- Original Message -----
From: "Guerrino Di Minno" <GDiMinno@h...>
To: "Professional Java" <pro_java@p...>
Sent: Friday, October 05, 2001 1:32 PM
Subject: [pro_java] Help with date format...
> HI to all,
>
> I'm a new comer at Visual J++ and I would like to
> know how can I format a date value to 10 / 04 / 01 and to 10 - 04 - 01.
> Two kinds of date format...
>
> Can someone PLEASE help me on how I can do this...
>
> Thanking you in advance ...
>
> Gino