Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileDatetoDateTime Problem

Status
Not open for further replies.

CatR

IS-IT--Management
Sep 4, 2003
2
US
I am using FileDatetoDateTime and FileAge to get the date and time stamp of a list of files. The date stamp is working fine. The time stamp is off. example of code below:

z := RZFileListBox1.Items.Count;
for x := 0 to z-1 do
begin
holdext := '';
holddatestamp := '';
FileNameEdit.Text := RZFileListBox1.Items.Strings[x];
holddate := FileDatetoDateTime(FileAge(FileNameEdit.Text));
holddatestamp := FormatDateTime('mm/dd/yy hh:ss AM/PM', holddate);
y := pos('S.wav', RZFileListBox1.Items.Strings[x]);
holdext := trim(copy(RZFileListBox1.Items.Strings[x], y-4, 4));
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update TeacherNames set LastAccessed = :holddatestamp '+
' where classcode = :holdext ');
Query1.ParamByName('holddatestamp').AsString := holddatestamp;
Query1.ParamByName('holdext').AsString := holdext;
Query1.ExecSQL;
end;

I am updating a table in Access with the date and time stamp. When I compare that date and time stamp value with what is actually in the directory, I see a difference in the time. The value I get from FileDatetoDateTime Problem may say something like 09/04/03 10:52AM and the directory may say 09/04/03 10:13AM. Another example is my value will say 09/03/03 12:14PM and the directory displays 09/03/03 12:59PM. Any idea why? Thanks!

 
Disregard! I found my problem! instead of formating the time hh:mm, I formated hh:ss. Duh!
 
Hey, you don't want 'hh:mm' either.

You want 'hh:nn'. In FormatDateTime mm refers to months; nn refers to hours.

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top