C# TryParseExact

DateTimeFormatInfo dtfi = new CultureInfo("zh-CN", false).DateTimeFormat;
DateTime output;
bool b = DateTime.TryParseExact(str, "HH:mm", dtfi, DateTimeStyles.None, out output);
this.Label1.Text = b.ToString();

你可能感兴趣的:(parse)