954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

I just need TIME not Date.

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.

THANKS!

jgoering
Newbie Poster
1 post since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

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

noman78
Light Poster
40 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

Hello,

This expression give you only the time.

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


I hope this help you.

AntonioGK
Newbie Poster
6 posts since Aug 2008
Reputation Points: 12
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You