var time = "";
string pattern = @"_(?<time>20\d{6})";
var regResult = Regex.Match(fileName, pattern);
if (regResult.Success)
{
time = regResult.Groups["time"].ToString();
}
var uploadDate = DateTime.ParseExact(time, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
C# 正则表达式匹配string字符串中的时间串(yyyyMMdd)
猜你喜欢
转载自www.cnblogs.com/zx724792526/p/11724009.html
今日推荐
周排行