🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
2 messages
2 total messages Started by Piet Doms Tue, 10 Dec 2002 20:22
Extract the Time Out of DateTime field
#11201
Author: Piet Doms
Date: Tue, 10 Dec 2002 20:22
21 lines
1280 bytes
Hello all,

Can somebody tell me how to extract the time value from a Datetime field

For now I use :
SELECT EXTRACT(HOUR FROM MYDATETIME) || ':' ||
EXTRACT(MINUTE FROM MYDATETIME)

FROM MYTABLE

the MYDATETIME value = 25-11-2002 19:01:00
the result will be 19:1

What I'm looking for = 19:01 instead of 19:1

Anybody any ideas

Thanks
Piet

Remove the spam_ from the emailadress
Re: Extract the Time Out of DateTime field
#11205
Author: Ivan Prenosil
Date: Wed, 11 Dec 2002 10:54
20 lines
1504 bytes
> Can somebody tell me how to extract the time value from a Datetime field
>
> For now I use :
> SELECT EXTRACT(HOUR FROM MYDATETIME) || ':' ||
> EXTRACT(MINUTE FROM MYDATETIME)
>
> FROM MYTABLE
>
> the MYDATETIME value = 25-11-2002 19:01:00
> the result will be 19:1
>
> What I'm looking for = 19:01 instead of 19:1

Do you really need result converted to string ?
I always prefer return correct datatype and format it on client:
  SELECT CAST(MYDATETIME AS TIME) FROM ...

--
Ivan
http://www.volny.cz/iprenosil/interbase
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads