S
Sammy
I have a date in string format 'yyyy-mm-dd'
I want to reformat this to 'dd-MMM-2004' so I can use it in an insert
statement into a Oracle DB.
The code below shows code I have so far. It should take a date and
reformat it as I require. But it doesn't work. It remains formatted in
yyyy-mm-dd!!
Can some one help me please?
Thanks in advance, Sammy
import java.util.*;
import java.lang.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class magic{
public String UDATE;
public SimpleDateFormat formatter = new
SimpleDateFormat("yyyy/MM/dd");
public SimpleDateFormat formatter2 = new
SimpleDateFormat("dd-MMM-yyyy");
public java.util.Date theDate;
public String retDate;
public magic(String DATE) {
super();
UDATE = DATE;
theDate = null;
retDate = null;
}
public String returnFormattedDate(){
try {
// Parse with a custom format
theDate = this.formatter.parse(this.DrawDate);
retDate = this.formatter2.format(theDate);
} catch (Exception e) {
}
return retDate;
} //close return date
} //end class
I want to reformat this to 'dd-MMM-2004' so I can use it in an insert
statement into a Oracle DB.
The code below shows code I have so far. It should take a date and
reformat it as I require. But it doesn't work. It remains formatted in
yyyy-mm-dd!!
Can some one help me please?
Thanks in advance, Sammy
import java.util.*;
import java.lang.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class magic{
public String UDATE;
public SimpleDateFormat formatter = new
SimpleDateFormat("yyyy/MM/dd");
public SimpleDateFormat formatter2 = new
SimpleDateFormat("dd-MMM-yyyy");
public java.util.Date theDate;
public String retDate;
public magic(String DATE) {
super();
UDATE = DATE;
theDate = null;
retDate = null;
}
public String returnFormattedDate(){
try {
// Parse with a custom format
theDate = this.formatter.parse(this.DrawDate);
retDate = this.formatter2.format(theDate);
} catch (Exception e) {
}
return retDate;
} //close return date
} //end class