/// <summary> /// 更改时间格式[HH:mm:ss]到[HHmmss] /// </summary> /// <param name="input"></param> /// <returns></returns> public static string TimeToJsonTime(string input) { string result = null; try { string searchExpress = "\\W(?<hour>\\d{1,2}):(?<minutes>\\d{1,2}):(?<seconds>\\d{1,2})\\W"; string replaceExpress = "\"${hour}${minutes}${seconds}\""; result = Regex.Replace(input, searchExpress, replaceExpress); } catch (Exception) { throw; } return result; }
以上是自己几笔记,如果要了解更加详细的可以看我的另一篇,.net 更改时间格式