Home > Net >  Convert time Span(10:47:00.0000000) value into this formate("hh:mm tt")
Convert time Span(10:47:00.0000000) value into this formate("hh:mm tt")

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,
                                  chkIN = VD.CheckIN.ToString(),
                                }).ToListAsync();

CodePudding user response:

List<ModelName> List = await (
                       linq query write here                                                           
                        select new ModelName          
                        {  
                         Column Names,  
                         checkin = VD.CheckIN.Value     
                        }).ToListAsync();  
   List.ForEach(x => x.chkIN = x.checkin.HasValue ? DateTime.Today.Add(x.checkin.Value).ToString("hh:mm tt") : "");  
        return List;
  • Related