I have a program that inserts some data into a table.
In my table im showing day and week number like the following output (in danish)
TO Uge 42
Where TO is the name of the day
Uge is week
and 42 is the number of the week.
What i would like to do is get the TO to be TOR(Short for Torsdagwhich is the danish word for Thursday)
My Code looks like this at the moment:
"DY' || ' ' || '\"Uge\" '|| 'IW";
Are there any whay in Orcle where i can get the date as a 3 lettered String or do i have to make substrings of the string and change it?
UPDATE ADDED SQL CODE FROM MY PROGRAM
String sql =
"SELECT " +
" TO_CHAR(MIN(TIDSPUNKT),'"+getDateDescriptionFormat(when)+"') AS PERIOD, " +
" NVL(QUEUE,' ') AS QUEUE, " +
" NVL(SUM(ANTAL_KALD),0) AS CALLS, " +
" NVL(SUM(ANTAL_BESVARET),0) AS ANSWERED_CALLS, " +
" NVL(SUM(BESVARET_25_SEK),0) AS ANSWERED_CALLS_25_SEC, " +
" NVL(SUM(INTERN_KALD),0) AS INTERNAL_CALLS " +
"FROM " +
" KS_DRIFT.PERO_NKM_KØ_OVERSIGT " +
"WHERE " +
" TIDSPUNKT >= '"+getStartDate(start,when)+"' AND " +
" TIDSPUNKT <= '"+ slut+"' AND " +
" TO_CHAR(TIDSPUNKT,'DY') NOT IN ('AB') " +
"GROUP BY " +
" TRUNC(TIDSPUNKT,'"+getDateFormatString(when)+"'), " +
" QUEUE " +
"ORDER BY " +
" PERIOD
THE getDateDiscribtionFormat:
private String getDateDescriptionFormat(char when){
if (when == 'D')return "DY' || ' ' || '\"Uge\" '|| 'IW";
if (when == 'W')return "\"Uge\" '||'IW";
if (when == 'M')return "Mon.' || ' ' || 'YYYY";
if (when == 'Y')return "YYYY";
return null;
}
Do note that I DID not make this code my former co worker did and it is messy !
Looks like there is no other format model that will do what you want. ‘DY’ gives the “abbreviated name of day” — in my English-language system this means a three-letter abbreviation, but I guess in your language the standard abbreviation is two letters.
Rather than doing a substring, I’d suggest converting to a numeric day of the week and then simply having a mapping, for example (using English abbreviations):