Skip to content
Advertisement

What is the purpose of the string “- 4/24” from a record that holds a date?

I have an already generated script that uses the following code: ORDER BY TO_CHAR((A.VERIFIED_DTTM - 4/24),'YYYY-MM-DD'). The output of A.VERIFIED_DTTM is a simple date eg: 09-SEP-19.

I was my understanding that 4/24 is the same as saying 4 hours. I have tried removing this string from my query and received radically different results (not just sorting or ordering).

In another area of the script, I have a code that makes excellent sense (A.VERIFIED_DTTM >= sysdate - 30). This I understand.

Can anyone explain what is actually happening with this query line?

Thank you!

Advertisement

Answer

It is subtracting 4 hours and converting the date value to a string in the format of YYYY-MM-DD. This is probably a timezone adjustment.

To be honest, I’m not sure why it doesn’t just use:

ORDER BY A.VERIFIED_DTTM 

Removing it should not radically change the results.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement