Dates in PS Query

From TekiWiki

Jump to: navigation, search

This whole wiki has now moved to http://www.springboardsolutions.com/wiki

Go to this page Dates in PS Query

Line 3: Line 3:
The date functions are particular to the database in use. For instance in Oracle:
The date functions are particular to the database in use. For instance in Oracle:
-
<pre>to_char(A.EFFDT,'YYYY-MM-DD')<\pre>
+
<pre>to_char(A.EFFDT,'YYYY-MM-DD')</pre>
The conversion to char means that the date functions will not work natively. You can convert this back to date by creating an expression as follows:
The conversion to char means that the date functions will not work natively. You can convert this back to date by creating an expression as follows:
-
to_date(A.EFFDT,'YYYY-MM-DD')
+
<pre>to_date(A.EFFDT,'YYYY-MM-DD')</pre>
This means that you can then use date functions:
This means that you can then use date functions:
-
add_months(to_date(A.EFFDT,'YYYY-MM-DD'),-12)
+
<pre>add_months(to_date(A.EFFDT,'YYYY-MM-DD'),-12)</pre>
Note that DateTimes can be converted differently and so care is needed when mixing data types.
Note that DateTimes can be converted differently and so care is needed when mixing data types.

Revision as of 15:09, 11 August 2013

Personal tools