Hi,
I have one table with 3 fields
Id - int
Name - varchar
JoinDate - datetime
Id Name JoinDate
1 a 2022-07-13 12:00:00
2 b 2022-07-13 9:30:00
3 c 2022-07-13 7:30:00
My requirement need to filter joindate values with date only
Can you please provide me sample query
Declare @FromDate datetime
Set @FromDate = '2022-07-13 13:39:31.757'
select * from Employee where JoinDate = @FromDate
Download FREE API for Word, Excel and PDF in ASP.Net:
Download
dharmendr
on Jul 13, 2022 07:35 AM
on Jul 13, 2022 07:37 AM
2
Hi mahesh213,
For comparing the Date only convert the Column and the parameter both to Date using the CAST function.
Declare @FromDate datetime
Set @FromDate = '2022-07-13 13:39:31.757'
select * from Employee where CAST(JoinDate AS DATE) = CAST(@FromDate AS DATE)