Get current time without Date

17,333

Solution 1

You can convert the GETDATE() results to a TIME datatype to pull the current time:

Select Convert(Time, GetDate())

Solution 2

You can do that pretty simply; if I correctly understood your problem.

SELECT CAST('INSERT THE TIME HERE' AS TIME(0))

Solution 3

And if using Sybase ASE 15+ you can use the current_time() function.

select current_time() -- returns 'time' datatype

You can also use the normal date/time-related and convert/cast functions against the resulting value as needed (eg, changing output format).

Solution 4

This query returns time with format "hh:mm:ss" :

Select Convert(Time(0), GetDate())
Share:
17,333
Moudiz
Author by

Moudiz

I work with oracle and Sybase.

Updated on June 04, 2022

Comments

  • Moudiz
    Moudiz about 2 years

    How do I get the current time only?

    select getdate()
    

    Gives me:

    Dec 16 2016  5:41PM
    

    I want this result:

    5:41PM