Click here to Skip to main content
15,906,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I am working on a time/attendance tracking application, and it is required that the user will want to search based on the time and date a user signs in, i have implemented search by date functionality, i still could not figure how to do it with time.

please i will appreciate your assistance. Thanks in advance
Posted
Comments
OriginalGriff 11-Mar-15 10:59am    
How have you done the date?
Remember, we have no idea how your database is organised, or what values you enter to it - so we can't just say "do this" and it'll work. There are as many wasy to do this as there are programmers, nearly! :laugh:
Uwakpeter 11-Mar-15 11:19am    
in my table, i have a field "ActionDate" with datetime type.
OriginalGriff 11-Mar-15 11:25am    
And?
How did you do it when you "implemented search by date functionality"?
Uwakpeter 11-Mar-15 11:35am    
i used the between keyword
OriginalGriff 11-Mar-15 11:38am    
How about you just post the relevant code fragment?

1 solution

As mentioned in the comments, if you have SQL 2008 or newer, to get just the time simply do:
SQL
select cast(GETDATE() as time)

or older versions of sql:
SQL
select convert(char(5), GETDATE(), 108)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900