473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Howto determine the Modified date of your executable?

Hello,

I know about the FileInfo.LastWriteTime() function. However, this is not
always returning the modified date of the executable that I want: when you
copy the executable to another directory the FileInfo.LastWriteTime()
function returns the copy-time.

I can see in my explorer that there is another modified time, the time when
I compiled the executable. My explorer (explorer2, that is, Zabkat's
dual-pane explorer) shows this timestamp also in the directory to which I
copied the executable, in the 'Modifed' column. So, there must be a field
somewhere that retains the original Modifed date. Does anyone know how to
get that?

What I really want is to have an 'About...' form in my application that
shows the last-build date. So, maybe there's another approach to that?

Regards,
Marcel Brekelmans
Sep 2 '06 #1
1 2923
I googled a nice way:

In your AssemblyInfo.cs file, leave out the Version and Build numbers:

[assembly: AssemblyVersion("1.1.*")]

After the compiler has build the application it has set Build to the number
of days since Jan 1, 2000 and Version to the number of seconds since
midnight (local time) divided by 2. From this information you can retrieve
the build timestamp:

Version v = new Version(Application.ProductVersion);

DateTime t = new DateTime((v.Build - 1) * TimeSpan.TicksPerDay + v.Revision
* TimeSpan.TicksPerSecond * 2).AddYears(1999);

TimeZone localZone = TimeZone.CurrentTimeZone;

DateTime tt = localZone.IsDaylightSavingTime(t) ? t.AddHours(1) : t;

lblBuild.Text = tt.ToString();

v.Build - 1 : the number of days includes the current day. For today however
you must only count the time elapsed specified by Revision
The addHours(), of course, is specific to my timezone.
"Marcel Brekelmans" <ma****@marcel-art.comschreef in bericht
news:KO******************************@giganews.com ...
Hello,

I know about the FileInfo.LastWriteTime() function. However, this is not
always returning the modified date of the executable that I want: when you
copy the executable to another directory the FileInfo.LastWriteTime()
function returns the copy-time.

I can see in my explorer that there is another modified time, the time
when I compiled the executable. My explorer (explorer2, that is, Zabkat's
dual-pane explorer) shows this timestamp also in the directory to which I
copied the executable, in the 'Modifed' column. So, there must be a field
somewhere that retains the original Modifed date. Does anyone know how to
get that?

What I really want is to have an 'About...' form in my application that
shows the last-build date. So, maybe there's another approach to that?

Regards,
Marcel Brekelmans

Sep 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
2
by: David Lindgren | last post by:
Hello. I am trying to figure out a way to determine if the user has resetted the system clock between two times of running my application. One idea I have is that I could check the modified date...
11
by: Dennis Marks | last post by:
There seems to be a major program with the automatic display of the last modified date. Using the javascript "document.lastModified" sometimes returns the correct date and sometimes 1 Jan 1970...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
4
by: shonend | last post by:
I am trying to extract the pattern like this : "SUB: some text LOT: one-word" Described, "SUB" and "LOT" are key words; I want those words, everything in between and one word following the...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
28
by: Tim Daneliuk | last post by:
I have a program wherein I want one behavior when a file is set as executable and a different behavior if it is not. Is there a simple way to determine whether a given named file is executable...
7
by: patrik.kahari | last post by:
Is there a c++ function similar to getcwd that does not give you the working directory but the directory or path of the currently running executable? I need this because im porting a game that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.