我有像06、07、08、.....、16、17、18这样的整数值。
我想将这些整数值转换为24小时制时间格式。
我正在尝试做如下操作:
//fromTime holds one of the integer value.
DateTime fromTimeDate = DateTime.ParseExact(fromTime.ToString(),
"HH",
CultureInfo.InvariantCulture);
string fromtimestring = fromTimeDate.ToString("hh:mm tt");
但是它报错了
"字符串未被识别为有效的日期时间。"
在解析时出现错误。
我在这里做错了什么?