How to get the files date and time from the server

alimceed used Ask the Experts™
Hello, How can i get the files date and time from a server? i try to use this line of codes "pdata.ftCreationTime" but i dont know how to use it. Thank you
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Try this:

Private Declare Function FileTimeToSystemTime Lib "kernel32" ( lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long

    wYear                   As Integer
    wMonth                  As Integer
    wDayOfWeek              As Integer
    wDay                    As Integer
    wHour                   As Integer
    wMinute                 As Integer
    wSecond                 As Integer
    wMillisecond            As Integer
End Type

msgbox GetSysTime ( pdata.ftCreationTime )

Private Function GetSysTime(ByRef udtTime As FILETIME) As Date

Dim udtSysTime  As SYSTEMTIME
FileTimeToSystemTime udtTime, udtSysTime
With udtSysTime
    GetSysTime = CDate(.wYear & "/" & .wMonth & "/" & .wDay & " " & .wHour & ":" & .wMinute & ":" & .wSecond)
End With
End Function

Hope this helps.
In VB u can get the file date and time as follows

Open a project
Go to Project - References
Add "Microsoft Scripting Runtime" library
and the following code gets u both date and time of creation ( you hv other options like datelastcreated, datelastmodified)

Private Sub Command1_Click()

Dim f As FileSystemObject
Dim l As File

Set f = New FileSystemObject

Set l = f.GetFile("C:\Temp\sample.txt")
MsgBox l.DateCreated

End Sub

hope this helps
Sorry, in my previous post I forgot too add this declaration:

Private Type FILETIME
   dwLowDateTime As Long
   dwHighDateTime As Long
End Type

Author of the Year 2009

Hi alimceed,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Split points between: willisp and aanymg

alimceed, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial