Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set workstation date time to match SQL Server
Message
De
07/03/2002 09:48:00
 
 
À
07/03/2002 03:36:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00629403
Message ID:
00629555
Vues:
10
This message has been marked as a message which has helped to the initial question of the thread.
This code will allow you to set local date time from VFP.
FUNCTION API_SetLocalTime
LPARAMETERS ltDateTime

** EXAMPLE ? API_SetLocalTime(DATETIME(1964,10,07,18,0,0))

  IF VARTYPE(ltDateTime) # "T"
    RETURN .F.
  ENDIF

  LOCAL lcString

  lcString = _Num2Word(YEAR(ltDateTime)) + ;
    _Num2Word(MONTH(ltDateTime)) + ;
    _Num2Word(DOW(ltDateTime)) + ;
    _Num2Word(DAY(ltDateTime)) + ;
    _Num2Word(HOUR(ltDateTime)) + ;
    _Num2Word(MINUTE(ltDateTime)) + ;
    _Num2Word(SEC(ltDateTime)) + ;
    _Num2Word(000) + SPAC(24)

  DECLARE SetLocalTime IN Win32Api ;
    STRING lcString

 M.SLT_RETVAL = SetLocalTime(lcString)
 
  RETURN M.SLT_RETVAL

*--------------------------------------
* FUNCTION _Num2Word(lnNumber)
*--------------------------------------
FUNCTION _Num2Word(lnNumber)
  LOCAL lcReturn, lnAscii
  lcReturn = ''
  DO WHILE lnNumber >= 256
    lnAscii = MOD(lnNumber,256)
    lcReturn = lcReturn + CHR(lnAscii)
    lnNumber = INT(lnNumber / 256)
  ENDDO
  lnAscii = lnNumber
  lcReturn = lcReturn + CHR(lnAscii)
  RETURN PADR(lcReturn, 2, CHR(0))
ENDFUNC
*--------------------------------------
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform