Oracle – Hide Zero Hours and Minutes with NLS_DATE_FORMAT

oracleoracle-11g-r2

I'm currently using date format:

alter session set nls_date_format = 'DD.MM.YYYY HH24:MI';

The (cosmetic) problem is that this always displays time even if it's zero, for example: "27.03.2014 00:00". Is it possible to hide 00:00 with NLS_DATE_FORMAT, but display the time when it's not zero?

I realize this is not a good idea for any kind of automatic processing but this is only for interactive use. I know I can format individual columns in the query but I'm interested in more general solution.

I did check the format model documentation but I didn't find any relevant parameters so maybe it's not possible.

Best Answer

No, it can not be done, because 00:00 is a valid time. That you use it to represent "no time available" in your application is your own decision and you have to take care of the consequences yourself.

You could store date and time in separate columns and show only the date if the time is NULL.