944,165 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 10243
  • MS SQL RSS
Nov 6th, 2005
0

I just need TIME not Date.

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jgoering is offline Offline
1 posts
since Nov 2005
Nov 23rd, 2005
0

Re: I just need TIME not Date.

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
Reputation Points: 10
Solved Threads: 0
Light Poster
noman78 is offline Offline
40 posts
since Nov 2005
Aug 13th, 2008
0

Re: I just need TIME not Date.

Hello,

This expression give you only the time.
MS SQL Syntax (Toggle Plain Text)
  1. CONVERT (varchar, GETDATE(), 114)
  2. -- this is the result
  3. -- 10:24:55:640



I hope this help you.
Last edited by AntonioGK; Aug 13th, 2008 at 2:28 pm. Reason: Add Result
Reputation Points: 12
Solved Threads: 1
Newbie Poster
AntonioGK is offline Offline
6 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Reading logs in MS SQL Server 2000
Next Thread in MS SQL Forum Timeline: SQL Join query not working correctly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC