I was asked

Is there a way to translate the timestamp in a VCX to a human readable format? 


Visual Foxpro puts a timestamp on many records in the table that represents a form or class library. Historically this field was used to match records across supported platforms: DOS, Mac, Unix, Windows.


The VFP reserved variable “_screen” is an object reference to the Form instance that represents the VFP desktop. Because it’s a form instance, you can save it as a class using the SaveAsClass method. This will cause a timestamp record to be created that we can use to run the sample code. The sample code delays 3 seconds, creates a subclass of the form, adds a button, then shows the timestamps of the items in the class library.


The timestamp is in a standard format.


ERASE t.vcx

_screen.AddObject("btn","commandbutton")  && add a button to the desktop

_screen.SaveAsClass("t.vcx","myform")           && create class myform in a target file t.vcx

INKEY(3)                      && delay 3 seconds

MODIFY CLASS xx OF t.vcx as myform FROM t.vcx nowait  && create a subclass of myform in the same file

ASELOBJ(aArray,1)                   && get an object reference to the class in the designer

aArray[1].addobject("btn2","commandbutton")     && and btn2 to the class

aArray[1].btn2.top=200                          && move it down so it doesn't hide btn

KEYBOARD "Y"                                    && a "y" in the "Do you want to save changes")

RELEASE WINDOWS "Class designer"    && close the designer

USE t.vcx                     && open the table

SCAN FOR timestamp!=0   && look for timestamps

      ?timestamp,DecodeTimeStamp(timestamp),objname+" "+class



PROCEDURE DecodeTimeStamp(nTimestamp as Number) as Datetime && see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/filetimetodosdatetime.asp












      RETURN DATETIME(nYear,nMonth,nDay,nHr,nMin,nSec)