Is there any utility that returns java.text.SimpleDateFormat
pattern from Oracle to_char
format pattern?
create or replace type type_sample as object (
f_id number,
f_name varchar2(100),
f_start_date date,
f_end_date date
)
/
SET SERVEROUTPUT ON
DECLARE
xmltype1 SYS.XMLType;
message type_sample;
BEGIN
message := new type_sample(1, 'Manohar', current_date, sysdate);
xmltype1 := XMLtype.createXML(message);
DBMS_OUTPUT.PUT_LINE('out_errm : '|| xmltype1.getStringVal());
END;
/
<TYPE_SAMPLE><F_ID>1</F_ID><F_NAME>Manohar</F_NAME><F_START_DATE>26-JAN-13</F_START_DATE>**<F_END_DATE>26-JAN-13</F_END_DATE>**</TYPE_SAMPLE>
I have the above XML coming form DataBase. Here the date format is coming in different formats based on the session the above code is run.
What I can do here is, can get that session's dateformat pattern from to java side. If I can convert that dateformat pattern(oracle db) to java.text.SimpleDateFormat
pattern, my problem is solved. Can you please help me out?
I am not getting the expected answer here. May be my presentation is not explaining the problem clearly.
I will ask a straight forward question now. As far as i know java.text.SimpleDateFormat is after all an implementation of java.text.DateFormat. This implementation of DateFormat can understand the following pattern letters
G Era designator
y Year
M Month in year
w Week in year
W Week in month
D Day in year
d Day in month
F Day of week in month
E Day in week
a Am/pm marker
H Hour in day (0-23)
k Hour in day (1-24)
K Hour in am/pm (0-11)
h Hour in am/pm (1-12)
m Minute in hour
s Second in minute
S Millisecond
z Time zone
Z Time zone
Are there any other implementations of java.text.DateFormat, which can understand some other pattern letter group? If any, please let me know.