public static String getDateString ( Date date ) { SimpleDateFormat sdf = new SimpleDateFormat ( sdformatMillisec ) ; sdf . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; StringBuffer dateBuffer = new StringBuffer ( sdf . format ( date ) ) ; // above string is in this format // 2005-05-04T09:34:18.444-0400 // convert it to // 2005-05-04T09:34:18.444-04:00 dateBuffer . insert ( dateBuffer . length ( ) - 2 , ":" ) ; return dateBuffer . toString ( ) ; }
Returns a date String from the specified Date object . It is expected to be called before passing the date to SDO set method .