在微观战略中从时间戳中提取出一天

时间:2014-10-01 04:43:23

标签: oracle timestamp microstrategy

我在Microstrategy中有一个时间戳字段,想要从中提取日期,年份和月份。

有效的Excel表达式是

ApplySimple("Month(#0)", [FIELD_TO_BE_WORKED])

Oracle的相应表达式是什么?

谢谢!

2 个答案:

答案 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