Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.FRX FIELDS

Status
Not open for further replies.

agbtech

Technical User
Nov 11, 2005
27
0
0
US
Does anyone know what the meaning of the 'timestamp' field is when opening a .frx file as a table? I thought it was Julian but it doesn't translate.
 
Here's a routine I wrote a few years back (it could be rewritten using the
VFP bit manipulation functions, but unless you're doing a lot of them, this
is probably good enough). If you want the bit layout, I've included that at
the end. (Feel free to beatify it - most of the layout spacing was deleted
so it it wouldn't word-wrap here!)

Rick
Code:
FUNCTION bo_dttm && break out date and time from timestamp
PARAMETER zx_DtTm
* Notes:  zx_DtTm is either a number or a character string representing
number
* Returns: Character String w/ "MM/DD/YYYY HH:MM:SS xM"
*               or Error message
*    [Change lcMsg at end of procedure to generate alternate output]
*
* Example: ? bo_dttm(510165755)
*                ? bo_dttm("510165755")
*
PRIVATE lnDtTm, lnYear, lnMonth, lnDay, lnHour, lnMinute, lnSecond, lcAMPM
PRIVATE llOK, lcMsg
llOK = .T.
lcMsg = ""
IF TYPE('zx_DtTm') = "N"
 lnDtTm = INT(zx_DtTm)
ELSE
 IF TYPE('zx_DtTm') = "C"
  lnDtTm = INT(VAL(zx_DtTm))
 ELSE
  llOK = .F.
 ENDIF
ENDIF
DO WHILE llOK && not really a LOOP - just a way to handle errors more easily
 lnSecond = MOD(lnDtTm, 32) * 2
 IF !BETWEEN(lnSecond, 0, 60)
  lcMsg = "Seconds out of range"
  llOK = .F.
  EXIT  && a way out
 ENDIF
 lnDtTm = INT(lnDtTm/32)
 lnMinute = MOD(lnDtTm, 64)
 IF !BETWEEN(lnMinute, 0, 60)
  lcMsg = "Minutes out of range"
  llOK = .F.
  EXIT  && a way out
 ENDIF
 lnDtTm = INT(lnDtTm/64)
 lnHour = MOD(lnDtTm, 32)
 IF !BETWEEN(lnHour, 0, 24)
  lcMsg = "Hours out of range"
  llOK = .F.
  EXIT  && a way out
 ENDIF
 lcAMPM = "am"
 DO CASE
 CASE BETWEEN(lnHour,0,11)
  * good enuff
 CASE lnHour=12
  lcAMPM = "pm"
 CASE BETWEEN(lnHour,13,24)
  lcAMPM = "pm"
  lnHour = lnHour - 12
 ENDCASE
 lnDtTm = INT(lnDtTm/32)
 lnDay = MOD(lnDtTm, 32)
 IF !BETWEEN(lnDay, 1, 31)
  lcMsg = "Day out of range"
  llOK = .F.
  EXIT  && a way out
 ENDIF
 lnDtTm = INT(lnDtTm/32)
 lnMonth = MOD(lnDtTm, 16)
 IF !BETWEEN(lnMonth, 1, 12)
  lcMsg = "Month out of range"
  llOK = .F.
  EXIT  && a way out
 ENDIF
 lnDtTm = INT(lnDtTm/16)
 lnYear = lnDtTm+1980
 EXIT
ENDDO
IF llOK
 lcMsg = transform(lnMonth,"@L 99")+"/" ;
    +transform(lnDay,"@L 99")+"/" ;
    +transform(lnYear,"@L 9999")+" " ;
    +transform(lnHour,"@L 99")+":" ;
    +transform(lnMinute,"@L 99")+":" ;
    +transform(lnSecond,"@L 99")+" " ;
    +lcAMPM
ENDIF
RETURN lcMsg
*** ------------------------------------------------------------------ ***
*!
*! Standard DOS TimeStamp is stored in the following format:
*! 32 bit integer (viewed logically NOT as would be in INTEL memory)
*!
*! 7 bits (31-25) - Year offset from 1980 Valid 0-127
*! 4 bits (24-21) - Month Valid 1-12 (not 0, 13-15)
*! 5 bits (20-16) - Day Valid 1-31 (not 0)
*! 5 bits (15-11) - Hour Valid 0-23 (not 24-31)
*! 6 bits (10-05) - Minute Valid 0-59 (not 60-63)
*! 5 bits (04-00) - Seconds (two at a time) Valid 0-29 (not 30-31)
*!
*! Notes: Earliest valid date 1/1/1980 and only good thru 12/31/2107
*! Can't have "odd" seconds
*!
*** ------------------------------------------------------------------ ***

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top