I'm working on a project that just needs to know that its 08:00 or 14:01. I dont need or want to store anything about date.

When I store the time and then try to check it against the current time I'm runnig into problems.

where (timeofevent = Convert(char(19),current_timestamp))

this doesnt work because Convert(char(19),current_timestamp
returns Nov 6 2005 6:39PM when what I need is 6:39PM or 18:39.

I need help getting the current time in that format.


u can use combination of SubString and instr function and can extract time from the date-time stamp
if is wht u wnat get back to me, i will give u the example


This expression give you only the time.

CONVERT (varchar, GETDATE(), 114)
-- this is the result
-- 10:24:55:640

I hope this help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.