我想将时差与两年长进行比较。
public const long TwoYears = 2 * 365 * 24 * 3600;
string currTime = DateTime.Now.ToString("yyyyMMddHHmmss");
string recordTime = fileName.Split('_','-').Last();// format is 'yyyyMMddHHmmss'
long diff = (long.Parse(currTime)) - (long.Parse(recordTime));
if (diff < TwoYears)
Console.WriteLine(fileName);
我做对了吗?