一、string.Format() 將【數字字元串】轉為兩位小數顯示的字元串: 1 dt = dtResult.Select(it => new CommodityPriceLimitEntity 2 { 3 CommodityId = it.CommodityId.ToString(), 4 Co ...
一、string.Format()
將【數字字元串】轉為兩位小數顯示的字元串:
1 dt = dtResult.Select(it => new CommodityPriceLimitEntity 2 { 3 CommodityId = it.CommodityId.ToString(), 4 CommodityName = it.CommodityName.ToString(), 5 CommodityCode = it.CommodityCode.ToString(), 6 Price = string.Format("{0:F2}", it.Price) 7 }).ToList();C# code
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
將時間轉為【yyyy/MM/dd HH:mm:ss】 格式顯示字元串:
1 if (!string.IsNullOrWhiteSpace(item.EffectiveTimeEnd)) // 生效結束時間 2 { 3 item.EffectiveTimeEnd = string.Format("{0}", item.EffectiveTimeEnd); 4 }C# code
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
持續更新中~~
蒙
2017-08-03 13:58 周四