ASP.Net Show Assembly Build Date

When creating an about page for a web application, we often add the build date information. To get the build date, we can query the executing assembly file and get the last write time property.

/// <summary>
/// returns the file write date
/// </summary>
/// <returns></returns>
private static string GetAssemblyDate()
string date = string.Empty;
var assembly = Assembly.GetExecutingAssembly();
var fileInfo = new FileInfo(assembly.Location);
var writeTime = fileInfo.LastWriteTime;
date = String.Format("{0} {1}", writeTime.ToShortDateString(), writeTime.ToShortTimeString());
}catch(Exception ex)
//log exception info
return date;

This helper method reads the file properties of the assembly and returns the date and time information. This is the same date-time information that we would find when using Windows Explorer.  The date time information return by this method has this format:

                MM/DD/YYYY hh:mm am/pm

I hope this helps some of you.