Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: HH:MM if today, else Mon, DD in SQL?
I would say that you need a truncate, ie
decode(trunc(time_due),
trunc(sysdate), to_char(time_due, 'HH-MM'), to_char(time_due, 'DD'))
HTH. Finn
Sybrand Bakker <postbus_at_sybrandb.demon.nl> wrote in message
news:954912231.12213.2.pluto.d4ee154e_at_news.demon.nl...
> decode(time_due, sysdate, to_char(time_due,'HH-MM'), to_char(time_due,
> 'DD'))
> should be all.
>
> Hth,
>
> Sybrand Bakker, Oracle DBA
>
> Otis Gospodnetic <otis_at_my-deja.com> wrote in message
> news:8ce9lr$gkb$1_at_nnrp1.deja.com...
> > Hi,
> >
> > I have a table that has a column with dates.
> > When I get rows from that table I would like to be able to show hours
> > and minutes if the date happens to be the current date(i.e. today);
> > otherwise I would like to display month and day.
> >
> > For example, say that I'm displaying something like a to-do list:
> >
> > task time due
> > ----------------------
> > meet Jackie 01:37
> > wake up 09:56
> > buy shoes April 10
> > go to Jelsa April 01
> > ...
> >
> > Is this doable in SQL without stored procedures and without post
> > processing of result set (comparing retrieved dates with current date)?
> >
> > Thank you,
> >
> > Otis
> > P.S.
> > Hmm...looks like an SQL question....but I am running Oracle 8.1.5.0.2
> > on Linux actually :)
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
>
Received on Wed Apr 05 2000 - 01:32:41 CDT
![]() |
![]() |