Any chance to get the file creation/modification date?

Discussion in 'Questions (Windows Mobile)' started by Christian72DD, Feb 26, 2008.

  1. Christian72DD

    Christian72DD Member

    Is there any DLL to get the date/time a file was created/modified?I have to compare wich one is the newer file.
     
  2. agraham

    agraham Expert Licensed User

    Have a play with this. See if it does what you need?

    EDIT :- the dates and times are a string. In case it is not obvious get the ticks value by :-
    Code:
    Dim dt(2' in globals

      ...

      DateFormat = 
    "dd/mm/yyyy" ' for those of us for whom the defaults fail
      TimeFormat = "hh:mm:ss"
      dt() = StrSplit(info(
    4)," ")
      d = DateParse(dt(
    0)) + TimeParse(dt(1)) Mod cTicksperday
      
    '  "mod" because the current date is included by TimeParse
     

    Attached Files:

    Last edited: Feb 26, 2008
  3. Christian72DD

    Christian72DD Member

    WOW, thats GREAT!

    Exactly what i need!

    Easy, small but powerfull!

    Thanks!
     
  4. agraham

    agraham Expert Licensed User

    For registered users I have posted an expanded version together with a help file in the "Additional libraries" forum.
     
  5. Christian72DD

    Christian72DD Member

    I just tried to read the file info of the program that is running to have an auto version number by this.
    But i always get an unsupported error-message.

    Is there no chance to read the file info of the program that uses this .dll?

    It would be great if this would be possible.


    Sub Globals
    Dim info(5)
    End Sub

    Sub App_Start
    Form1.Show
    FilesEx1.New1
    info() = FilesEx1.FileInfo("DateTest.exe")
    Label1.Text = "Version " & SubString(info(2),6,4)-2007 &"."& Int(SubString(info(2),3,2))&"."& Int(SubString(info(2),0,2))
    End Sub


    The program is called DateTest.exe, so it has to read its own info.
     
    Last edited: Mar 6, 2008
  6. agraham

    agraham Expert Licensed User

    There is no problem in doing this.

    If it is not finding the file try

    info() = FilesEx1.FileInfo(AppPath & "\DateTest.exe")

    If that still doesn't work check the actual strings returned with a msgbox() before trying to build your version string to check the formatting. The strings may be differently formatted between device and desktop.
     
Loading...