I have table called MCALLERS on my database that has column which called CallDate, datatype is datetime stored data as 2016-02-01 17:01:00.000
on my web Form I have dropdownlist which is populating month and year as March-2016.
how to convert datetime into month and year when I search data.I want to search data from database using Month and year as (March-2016). I'm sing C#.
Thanks in advance
what I have tried
C#
select BusinessCallYN,CallID,NewNam,CallDate,CalledNo,CallExt,CallDuration,Amount,tmpNewNam from MCALLERS where UserName='"+txtEmail+"' and CallDate>='"+cmddropdownlist1+"' and CallDate'"+cmddropdownlist1+"' and Amount>0 order by CallDate
Pramod ThakurRank #400 · 6.3K reputationPosted Mar 30, 2016, 2:09 AM EDT
ali tuncerRank #1,498 · 1.1K reputationPosted Mar 29, 2016, 7:57 AM EDT
select YEAR(CallDate),Month(CallDate),DATENAME(Month, CallDate) AS 'Month Name'
from MCALLERS
will display year, month number,month name like 2016 3 MarchPramod ThakurRank #400 · 6.3K reputationPosted Mar 29, 2016, 6:19 PM EDT
Lucas Ngobeni175 reputationPosted Mar 29, 2016, 10:55 PM EDT