Snippet Name: Date Math Sample 1 Description: An example of subtracting dates to get the difference between them. Also see:» FUNCTIONS: date/time » UPDATE: Update a partitioned table » UPDATE: Update based on a record » UPDATE: Update Object Table » UPDATE: with RETURNING clause » UPDATE: Nested Table Update example » UPDATE: Correlated Update » UPDATE: Update from a SELECT statement » UPDATE: based on multiple returned val... » UPDATE: Update based on a query » UPDATE: Update multiple rows » UPDATE: update a specific record » UPDATE: Single row » Date Functions: EXTRACT » Date Functions: TO_DSINTERVAL » Date Functions: TO_NCHAR » Date Functions: TO_YMINTERVAL » Date Functions: Calculate elapsed time... » Date and Time Calculations: Get second... » Date: Find first day of the month » Date Calculations » Date Functions: WHERE Clause Joins » Date Functions: TRUNC » Date Functions: SYSDATE » Date Functions: TO_CHAR » Date Functions: ROUND » Date Functions: NEXT_DAY » Date Functions: NEW_TIME » Date Functions: MONTHS_BETWEEN » Date Functions: MIN Comment: (none) Language: Highlight Mode: PLSQL Last Modified: March 02nd, 2009
Description: An example of subtracting dates to get the difference between them.
Also see:» FUNCTIONS: date/time » UPDATE: Update a partitioned table » UPDATE: Update based on a record » UPDATE: Update Object Table » UPDATE: with RETURNING clause » UPDATE: Nested Table Update example » UPDATE: Correlated Update » UPDATE: Update from a SELECT statement » UPDATE: based on multiple returned val... » UPDATE: Update based on a query » UPDATE: Update multiple rows » UPDATE: update a specific record » UPDATE: Single row » Date Functions: EXTRACT » Date Functions: TO_DSINTERVAL » Date Functions: TO_NCHAR » Date Functions: TO_YMINTERVAL » Date Functions: Calculate elapsed time... » Date and Time Calculations: Get second... » Date: Find first day of the month » Date Calculations » Date Functions: WHERE Clause Joins » Date Functions: TRUNC » Date Functions: SYSDATE » Date Functions: TO_CHAR » Date Functions: ROUND » Date Functions: NEXT_DAY » Date Functions: NEW_TIME » Date Functions: MONTHS_BETWEEN » Date Functions: MIN
SELECT TO_DATE(TO_CHAR(TO_DATE('28-FEB-95', 'DD-MON-YY'), 'ddd') - TO_CHAR(TO_DATE('15-SEP-94', 'DD-MON-YY'), 'ddd') , 'ddd') FROM dual /