public ActionResult AddAuction(AuctionAddViewModel model) { TimeSpan tooBig = new TimeSpan(2, 8, 8, 8); //yourDbEntity.timeValue = temp; PersianDateTime persianDate = new PersianDateTime(); var dd = model.Date.Split('-'); persianDate = new PersianDateTime(int.Parse(dd[0]), int.Parse(dd[1]), int.Parse(dd[2]), model.Auction_Time.Hours, model.Auction_Time.Minutes, 0); var dateMi = persianDate.ToDateTime(); //convert datetime Persian to miladi var cur = DateTime.Now.AddSeconds(-DateTime.Now.Second); //datetime without seconde var def = dateMi.Subtract(cur); //get def var auction_Time = new TimeSpan(def.Days, def.Hours, def.Minutes, 0, 0); var h = auction_Time.Days * 24; var hh = h + auction_Time.Hours; var timestring = auction_Time.TotalHours; //to database Int64 tooBigBits = auction_Time.Ticks; Int64 truncated = tooBigBits >> 24; TimeSpan temp = TimeSpan.FromTicks(truncated); //from database //Int64 truncated1 = temp.Ticks; //Int64 adjusted = truncated1 << 24; //TimeSpan actual = TimeSpan.FromTicks(adjusted); model.Auction_Time = temp; var result = repo.AddAuction(model); if (result) { return(RedirectToAction("Index")); } else { var allProduct = ProRepo.GetProForDop(); return(View(allProduct)); } }