We have a requirement on our intranet to display the file date/time of our applciations. There doesn't appear to be a
simple way to do this in .NET, but I came up with the following to display what is, basically, the file date/time of the assembly DLL.
In AssemblyInfo.cs ensure you have the following:
Code:
[assembly: AssemblyVersion("2.1.*")] The will cause the Version Attribute to be set to:
major.minor.date.time
where
date is the number of day since 01 JAN 2000
time is the number of seconds since midnight / 2
So, to return the 'compile' date of the Assembly, I use the following Property:
Code:
public string lastModified
{
get
{
string[] strArray = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split(new char[] { '.' });
return new DateTime(2000, 1, 1).AddDays(Convert.ToDouble(strArray[2])).AddSeconds(Convert.ToDouble(strArray[3]) * 2).ToString();
}
} FWIW.
