Forum Stats

  • 3,854,944 Users
  • 2,264,436 Discussions
  • 7,905,839 Comments

Discussions

Format mask that auto capitalizes month and day based on language rules

InoL
InoL Member Posts: 10,070 Gold Crown

With TO_CHAR on a date you have to explicitly set the capitalization: Month, month, Day, day.

Languages may already have their capitalization rules, e.g. English vs Spanish:

Monday - lunes

January - enero

The idea is to have a new "auto capitalize" format for days and months based on the language rules. Something like "acmonth" and "acday"

select to_char(sysdate, 'fmacday dd acmonth yyyy', 'NLS_DATE_LANGUAGE = SPANISH') today
from dual

viernes 22 julio 2022

select to_char(sysdate, 'fmacday dd acmonth yyyy', 'NLS_DATE_LANGUAGE = ENGLISH') today
from dual

Friday 22 July 2022

Or a new "ac" modifier for the whole string (like fm)

select to_char(sysdate, 'acfmday dd month yyyy', 'NLS_DATE_LANGUAGE = SPANISH') today
from dual


InoL
1 votes

Active · Last Updated