oracle date subtraction to get the number of days

The Oracle database queries the number of days between two dates. I saw that there are two functions to_char and to_date. When encountering English letters in the month of the date format, it has to be converted, for example: select to_char(date,'mm/mon/yy ','nls_date_language=american') from table, to_date conversion must be used with to_char, which is troublesome.

Here is another function that is more convenient: trunc();

For example: (select TRUNC(t.finish_time) - TRUNC(t.start_time)) as the number of days apart from table t

Guess you like

Origin blog.csdn.net/justin_sunshine/article/details/85112034