finding a file date 
Author Message
 finding a file date

I want to look at the date the file was created to determine if I should
runa process or not....it is an export file created by another
program...how can I get the file date into code...to compare it?

thanks



Mon, 24 Jul 2000 03:00:00 GMT  
 finding a file date

Have a look at the FileDateTime function in  help

Terry



Quote:
> I want to look at the date the file was created to determine if I should
> runa process or not....it is an export file created by another
> program...how can I get the file date into code...to compare it?

> thanks



Tue, 25 Jul 2000 03:00:00 GMT  
 finding a file date

Hi,

Easiest way is to use FileDateTime function...
Dim datFileStamp as variant
    datFileStamp = FileDateTime("C:\Autoexec.bat")

HTH

--
Just my $0.001
Dev Ashish
---------------

:I want to look at the date the file was created to determine if I should
:runa process or not....it is an export file created by another
:program...how can I get the file date into code...to compare it?
:
:thanks



Tue, 25 Jul 2000 03:00:00 GMT  
 finding a file date

I think I forgot one important bit of info...I'm using Access 2.0 and it
doesn't have that function.....at least not that I can find in help....I
searched the function list...and the refrence book too
-------------------------

Quote:

> Hi,

> Easiest way is to use FileDateTime function...
> Dim datFileStamp as variant
>     datFileStamp = FileDateTime("C:\Autoexec.bat")

> HTH

> --
> Just my $0.001
> Dev Ashish
> ---------------


> :I want to look at the date the file was created to determine if I should
> :runa process or not....it is an export file created by another
> :program...how can I get the file date into code...to compare it?
> :
> :thanks



Tue, 25 Jul 2000 03:00:00 GMT  
 finding a file date

Hi,

Ah Hah!! Now you mention that you're using 2.0 :-)

Try this piece of code instead
      Type OFSTRUCT
         cBytes As String * 1
         fFixedDisk As String * 1
         nErrCode As Integer
         szReserved As String * 4
         szPath As String * 128
      End Type
      Global Const OF_EXIST = &H4000
      Declare Function WinOpenFile Lib "KERNEL.EXE" Alias _
          "OpenFile" (ByVal szFileName As String, _
          OpenBuff As OFSTRUCT, ByVal Flag As Integer) As Integer

      Function GetFileDateTime (ByVal FileName As String) As Variant
         Dim ofs As OFSTRUCT
         Dim iDate As Long
         Dim iTime As Long
         Const DAY_MASK = &H1F
         Const MONTH_MASK = &H1E0
         Const YEAR_MASK = &HFE00
         Const SECOND_MASK = &H1F
         Const MINUTE_MASK = &H7E0
         Const HOUR_MASK = &HF800
         If WinOpenFile(FileName, ofs, OF_EXIST) <> -1 Then
            iDate = Asc(Mid$(ofs.szReserved, 2, 1)) * 256& _
                + Asc(Mid$(ofs.szReserved, 1, 1))
            iTime = Asc(Mid$(ofs.szReserved, 4, 1)) * 256& _
                + Asc(Mid$(ofs.szReserved, 3, 1))
            GetFileDateTime = DateSerial(((iDate And YEAR_MASK) \ _
                &H200) + 1980, (iDate And MONTH_MASK) \ &H20, (iDate And _
             DAY_MASK)) + TimeSerial((iTime And HOUR_MASK) \ &H800, _
            (iTime And MINUTE_MASK) \ &H20, (iTime And SECOND_MASK) * 2)
         Else
            GetFileDateTime = Null
         End If
      End Function

HTH
--
Just my $.001
Dev Ashish
---------------

:I think I forgot one important bit of info...I'm using Access 2.0 and it
:doesn't have that function.....at least not that I can find in help....I
:searched the function list...and the refrence book too
:-------------------------
:>
:> Hi,
:>
:> Easiest way is to use FileDateTime function...
:> Dim datFileStamp as variant
:>     datFileStamp = FileDateTime("C:\Autoexec.bat")
:>
:> HTH
:>
:> --
:> Just my $0.001
:> Dev Ashish
:> ---------------
:>
:> :I want to look at the date the file was created to determine if I should
:> :runa process or not....it is an export file created by another
:> :program...how can I get the file date into code...to compare it?
:> :
:> :thanks



Tue, 25 Jul 2000 03:00:00 GMT  
 finding a file date

thanks that worked....yeah..as soon as I saw the first reply...I knew I
had forgotten something vital.... :)

thanks again!!!

Quote:

> Hi,

> Ah Hah!! Now you mention that you're using 2.0 :-)

> Try this piece of code instead



Thu, 27 Jul 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Finding date from a txt file

2. procedure to find certain files from a certain date on harddisk

3. Finding file version & date info

4. Finding a files last access date

5. find files by date

6. Find files updated after certain date in a folder

7. finding file date/time & attributes

8. Finding file version & date info

9. Help Finding dates less than todays date?

10. Finding the date(s) datapoints between a given start and end date, while excluding weekends

11. File Creat Date and Modified Date...

12. Windows Find (Start:Find:Files and Folders)

 

 
Powered by phpBB® Forum Software