我在Microstrategy中有一个时间戳字段,想要从中提取日期,年份和月份。
有效的Excel表达式是
ApplySimple("Month(#0)", [FIELD_TO_BE_WORKED])
Oracle的相应表达式是什么?
谢谢!
答案 0 :(得分:2)
只是为了使用Lalit建议,对于本月,您可以使用以下ApplySimple
公式:
1
ApplySimple("EXTRACT(MONTH FROM #0)", [FIELD_TO_BE_WORKED])
2
ApplySimple("TO_CHAR(#0,'Month')", [FIELD_TO_BE_WORKED])
3
ApplySimple("TO_CHAR(#0,'Mon')", [FIELD_TO_BE_WORKED])
答案 1 :(得分:0)
有几种方法,从列表中选择你想要的东西:
1
SQL> SELECT EXTRACT(DAY FROM SYSTIMESTAMP) THE_DAY,
2 EXTRACT(MONTH FROM SYSTIMESTAMP) THE_MONTH,
3 EXTRACT(YEAR FROM SYSTIMESTAMP) THE_YEAR
4 FROM DUAL
5 /
THE_DAY THE_MONTH THE_YEAR
---------- ---------- ----------
1 10 2014
SQL>
2
SQL> SELECT TO_CHAR(SYSTIMESTAMP,'Day') THE_DAY,
2 TO_CHAR(SYSTIMESTAMP,'Month') THE_MONTH,
3 to_char(SYSTIMESTAMP,'Year') THE_YEAR
4 FROM DUAL
5 /
THE_DAY THE_MONTH THE_YEAR
--------- --------- ------------------------------------------
Wednesday October Twenty Fourteen
3
SQL> SELECT TO_CHAR(SYSTIMESTAMP,'Dy') THE_DAY,
2 TO_CHAR(SYSTIMESTAMP,'Mon') THE_MONTH,
3 to_char(SYSTIMESTAMP,'YYYY') THE_YEAR
4 FROM DUAL
5 /
THE THE THE_
--- --- ----
Wed Oct 2014