Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples

Sponsored Links

Discuss "Display Assembly File Date And Time" in the Code Samples forum.

Code Samples - Search through our code samples to give your application that something extra or provide a code sample of your own.


Reply « Previous Thread | Next Thread »  
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1  
Old April 9th, 2008, 11:57 AM
Wolffy's Avatar
Slaprentice of Wolves

 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 175
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default Display Assembly File Date And Time

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.
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > Code Samples

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
edit one at a time guddu JavaScript Programming 4 August 21st, 2008 10:57 AM
keep time and date javier_83 Microsoft Access 6 August 15th, 2008 06:03 PM
[JavaScript] JavaScript Date & Time Display jmurrayhead Code Samples 0 August 13th, 2008 08:46 PM
Time Entry Form sbenj69 Microsoft Access 2 July 14th, 2008 02:11 PM
Site Down Time jmurrayhead Announcements 0 March 30th, 2008 09:42 AM

LinkBacks (?)
LinkBack to this Thread: http://www.developerbarn.com/code-samples/115-display-assembly-file-date-time.html
Posted By For Type Date
DeveloperBarn Forums - ASP Help, ASP.Net Help, PHP Help, SQL Help, Tutorials, Windows Help This thread Refback April 26th, 2008 09:35 AM


All times are GMT -4. The time now is 04:21 PM.



Content Relevant URLs by vBSEO 3.2.0