Getting the time the file was compiled in line

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I want to add to my about box a message of when the system was last
compiled. Is there any way to get this?

UJ.
 
UJ said:
I want to add to my about box a message of when the system was last
compiled. Is there any way to get this?
Yes. I wrote the below function for the very reason you describe and, from
my initial tests, it looks like it works as expected. It takes advantage of
the fact that the Build and Revision values are based on the current
date/time.

Enjoy!

- Mitchell S. Honnert

Private Function GetVersionDate() As Date

Dim MyVersion As Version =
System.Reflection.Assembly.GetExecutingAssembly.GetName.Version

'Base date is 1/1/2000

Dim VersionDate As Date = New Date(2000, 1, 1)

'Build number is days since 1/1/2000, so add days

VersionDate = VersionDate.AddDays(MyVersion.Build)

'Revision number is half the seconds since midnight, so add twice as many
seconds

VersionDate = VersionDate.AddSeconds(MyVersion.Revision * 2)

Return VersionDate

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top