1
Answer

find yearly, monthly

hi! frnds
using  Entity Framework 
 
How to get particular year data from the data base using Entity frame work.
like
 S.no Dateofjoin(yyyy-mm-dd format)
 2015-09-01
 2 2014-09-31
 3 2015-09-22
 4 2014-08-25
 
 1. I will give 2015 and 09 (month)
2015-09-31
S.no Dateofjoin(yyyy-mm-dd format)
1 2015-09-01


3 2015-09-22
 
 
2.  i will give 2015(yyyy)
 
 
 s.no Doj
 1 2015-09-01
3 2015-09-31
 
 please provide solution 
Answers (1)
0
Manoj Bhoir

Manoj Bhoir

NA 7.6k 294.2k 9y
Hi,
 
If Dateofjoin is in Datetime format.
 
Try this :
 
Dateofjoin.ToString("yyyy-MM") = "2015-09"
Dateofjoin.ToString("yyyy") = "2015"