以 "Two Thousand and Nineteen" 等格式显示当前年份

Display current year in a format such as "Two Thousand and Nineteen"

我正在尝试以如下格式显示当前日期:

Today is the twenty-eighth of February, Two Thousand and Nineteen

目前,我有:

SELECT 'Today is the ' || TO_CHAR(CURRENT_DATE, 'ddspth') || ' of ' || TO_CHAR(CURRENT_DATE, 'Month, YyYYsp') FROM DUAL

给出:

Today is the twenty-eighth of February , Two Thousand Nineteen

但我想要这样的东西:

Today is the twenty-eighth of February , Two Thousand and Nineteen

如何实现?

我不知道有什么直接格式模型可以按照您想要的方式对其进行格式化,但您可以通过一些额外的工作来完成:

SELECT 'Today is the ' || 
       TO_CHAR(CURRENT_DATE, 'ddspth') || ' of ' || 
       TO_CHAR(CURRENT_DATE, 'Month,') || 
       TO_CHAR(ADD_MONTHS(trunc(CURRENT_DATE,'CC'),-12),'YyYYsp') || ' and ' || 
       TO_CHAR(CURRENT_DATE,'Yysp') 
FROM DUAL;

Today is the twenty-eighth of February ,Two Thousand and Nineteen

基本上,找出当前世纪的第一年并单独拼写出来,然后添加单词 "and" 并拼写出年份的最后两位数字。