Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(2015) to Date Time
Message
 
To
24/10/2002 08:27:40
Adrian Fricker
Custom Computer Solutuion Ltd.
St. Albans, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00714731
Message ID:
00714788
Views:
16
>Thanks but unfortuantly the only language I can speak is English & Fox
>
>Cheers
>Adrian

No problem, the code in language Fox is:
lc = SYS(2015)
? lc
? Inv2015(lc)

*-------------------------------
* FUNCTION Inv2015(tcCadena)
*-------------------------------
* Función que invierte el retorno de SYS(2015)
* USO: Inv2015("_0AB0123AB")
* RETORNA: Caracter "DD/MM/AAAA HH:MM:SS.mmm"
*-------------------------------
FUNCTION Inv2015(tcCadena)
  LOCAL lnDia, lnAnio
  lnDia = B36TOB10(SUBS(tcCadena, 2, 3))
  lnAnio = INT(lnDia / 367)
  lnDia = MOD(lnDia, 367)
  RETURN DTOC(EVAL("{^"+STR(lnAnio,2)+"/01/01}") ;
    + lnDia - 1) + " " ;
    + S2HMSm(B36TOB10(SUBS(tcCadena, 5, 6))/1000)
ENDFUNC

*-------------------------------
* FUNCTION B36TOB10(tcN36)
*-------------------------------
* Función que pasa un número de base 36 a base 10
* Usada por Inv2015()
* RETORNA: Numérico
*-------------------------------
FUNCTION B36TOB10(tcN36)
  LOCAL lnN10, lcChr, lnLen, lnI, lnAux
  tcN36 = ALLTRIM(UPPER(tcN36))
  lnLen = LEN(tcN36)

  lnN10 = 0
  lnI = 1
  FOR lnI = 1 TO lnLen
    lcChr = SUBS(tcN36, lnI, 1)
    lnAux = ASC(lcChr)-IIF(lcChr < 'A', 48, 55)
    lnN10 = lnN10 + lnAux * 36^(lnLen-lnI)
  ENDFOR
  RETURN INT(lnN10)
ENDFUNC

*-------------------------------
* FUNCTION S2HMSm(tnSeg)
*-------------------------------
* Transforma segundos a formato HH:MM:SS.mmm
* Usada por Inv2015()
* RETORNA: Caracter 'HH:MM:SS.mmm'
*-------------------------------
FUNCTION S2HMSm(tnSeg)
  LOCAL lnHor, lnMin, lnSeg, lnMil
  lnHor = INT(tnSeg/3600)
  lnMin = INT(((tnSeg - (lnHor*3600))/60))
  lnSeg = MOD(tnSeg, 60)
  lnMil = (tnSeg - INT(tnSeg))*1000
  RETURN TRANSFORM(lnHor, "@L 99") + ":" + ;
    TRANSFORM(lnMin, "@L 99") + ":" + ;
    TRANSFORM(lnSeg, "@L 99") + "." + ;
    TRANSFORM(lnMil, "@L 999")
ENDFUNC

*-------------------------------
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform