Skip to content

Find yearly, monthly

veerendra kumar

veerendra kumar

Asked Jun 23, 2015, 10:30 PM EDT1 answer
Share
LinkedInX
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)
1  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 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    0
    Hi,
     
    If Dateofjoin is in Datetime format.
     
    Try this :
     
    Dateofjoin.ToString("yyyy-MM") = "2015-09"
    Dateofjoin.ToString("yyyy") = "2015" 
    0