I used c# asp.net mvc5 ...
How I Covert Gregorian date to Hijri date In LINQ sql ?
CultureInfo arSA = new CultureInfo("ar-SA");
arSA.DateTimeFormat.Calendar = new HijriCalendar();
ViewBag.Service_Get_REC = new List<svr_Service_Get_REC>
((from m in _db.Service_Get_REC
join c in _db.encodingMSG
on m.G_Note_ID equals c.EncToId
where c.EncId == 4001 && m.G_Id ==
service_Get_Data.FirstOrDefault().svr_D.id
orderby m.G_Add_Date
select new
{
id = m.id,
G_Id = m.G_Id,
G_user_name = m.G_user_name,
EncMsgForUser = c.EncMsgForUser,
EncMsgForSvr = c.EncMsgForSvr,
G_Add_Date = m.G_Add_Date,
H_date = m.G_Add_Date.ToString()
}).AsEnumerable().Select(x => new svr_Service_Get_REC
{
id = x.id,
G_Id = x.G_Id,
G_user_name = x.G_user_name,
G_Add_Date = x.G_Add_Date,
EncMsgForUser = x.EncMsgForUser,
EncMsgForSvr = x.EncMsgForSvr,
H_date = x.G_Add_Date.ToString()
}).ToList());
return View(service_Get_Data.FirstOrDefault());
I need to conver H_date to hijri date in code
H_date = m.G_Add_Date.ToString()
Same this
ViewBag.H_date = service_Get_Data.FirstOrDefault().svr_M.DateOfBirth.ToString("yyyy/MM/dd", arSA);
How can I do this directly IN LINQ sql?
Thank you very much for helping me.
Thank you so much I have solved the problem This code is for anyone who wants to use it