Home > OS >  Convert Date formate ("yyyy MM dd") into this Date formate("dd MMM yyyy")
Convert Date formate ("yyyy MM dd") into this Date formate("dd MMM yyyy")

Time:11-12

LINQ to Entities does not recognize the System.String ToString(System.String) method, and this method cannot be translated into a store expression.

         List<ModelName> List = await (    
                           linq query write here   
                            select new ModelName  
                            {  
                             Column Name,   
                             BlacklistDate = VM.BlacklistDate.Tostring()      
                          }).ToListAsync();

CodePudding user response:

Answer

  List<ModelName> List = await (    
                       linq query write here   
                        select new ModelName  
                        {  
                         Column Name,   
                         _BlacklistDate = VM.BlacklistDate.Value,     
                      }).ToListAsync(); 
                         List.ForEach(x => x.BlacklistDate = x._BlacklistDate.HasValue ? (x._BlacklistDate.Value).ToString("dd MMM yyyy") : "");  
                         return List;
  • Related