Extract time part from datetime field

hi could anyone tell me how to extract the time part from a datetime field in the Designer?
I’m using SQL server as a database.
Thanks in advance!


sabine8 :lebanon: (BOB member since 2007-01-05)

Hi,
Please find the following 2 queries.
first will give you 24 hour clock value for the period,
second with give you 12 hour clock time for the value.

select to_char(sysdate,‘HH24:MI:SS’)
from dual;

select to_char(sysdate,‘HH:MI:SS AM’)
from dual;

Hope this helps you.


Omkar Paranjpe :us: (BOB member since 2006-02-13)

Or use Convert with a style:-

CONVERT(VARCHAR(10),Columnname.Fieldname, 108) 

Mak 1 :uk: (BOB member since 2005-01-06)

Thanks for your help but this is not what i need.
I need to get the time value from two datetime fields in order to subtract them later on.
So i need them as numbers or dates not as char.
Thanks again.


sabine8 :lebanon: (BOB member since 2007-01-05)

Try:-

CONVERT(datetime,CONVERT(VARCHAR(10),Columnname.Fieldname, 108)) 

Mak 1 :uk: (BOB member since 2005-01-06)