Finding date of a file in runtime

Posted on 2001-06-20
Last Modified: 2013-12-26
I'm using PB 7.0 and would like to know how to find out the date and time of a file (*.txt/*.pbd) during runtime.  URGENT!!

Thank you,
Question by:baskar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Author Comment

ID: 6209593
pls mail to

Expert Comment

ID: 6209676
If you saved your  *.txt file as "tab Separated"  file. Make a datastore from this file and you can access any time to your datastore.  (ImportFile function for *.Txt file). The count of your datastore columns must be equal to the *.txt file columns.

Author Comment

ID: 6209692
Hi Bhatti,

No I won't be reading the file, I mean the contents. I just wants to know the last edited date and time of the file.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 6209736
Hi Bhatti,

No I won't be reading the file, I mean the contents. I just wants to know the last edited date and time of the file.

Expert Comment

ID: 6209897
Try with API/SDK functions to find data and time of file attributes.

Accepted Solution

Miguel_Angel earned 100 total points
ID: 6213773
If you have worked with API's before you wouldn't find any problems with that.

You need to use 2 API's:

BOOL GetFileTime(
  HANDLE hFile,                 // handle to file
  LPFILETIME lpCreationTime,    // creation time
  LPFILETIME lpLastAccessTime,  // last access time
  LPFILETIME lpLastWriteTime    // last write time

BOOL FileTimeToSystemTime(
  CONST FILETIME *lpFileTime,  // file time to convert
  LPSYSTEMTIME lpSystemTime    // receives system time
And for working with them you need this previus created structures:

     long v_lowdatetime
     long v_highdatetime
     int v_year
     int v_month
     int v_dayofweek
     int v_day
     int v_hour
     int v_minute
     int v_second
     int v_millisecond
And the script would look like:

string filename
long   fileid

st_filetime   creationtime, lastaccesstime, lastwritetime
st_systemtime systemtime

filename = "c:\testfile.txt"
fileid   = fileopen(filename)

getfiletime(fileid, creationtime, lastaccesstime, lastwritetime)

filetimetosystemtime(creationtime, systemtime)

And voila, you have in systemtime.v_year, systemtime.v_month, and so on. Of course several error filters should help too, but this isbasically what you need to know.

Good luck.

Author Comment

ID: 6251967
Thank you very much for your guidance. Sorry for the delay in getting back.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question