Accueil > > > [VFP]CLASSE SYSTEMTIME
[VFP]CLASSE SYSTEMTIME
Information sur la source
Description
Petite classe VFP pour manipulation des SYSTEMTIME de l'API windows en datetime VFP.
Source
- m.lcSt=CREATEOBJECT("SystemTime")
- m.lcSt.GetUTC()
- m.tUTC = m.lcSt.DateTime()
- m.lcSt.GetLocal()
- m.tLocal = m.lcSt.DateTime()
- ? m.tLocal-m.tUtc, "secondes d'écart entre UTC et Local"
- ? (m.tLocal-m.tUtc)/60, "minutes"
- ? (m.tLocal-m.tUtc)/3600, "heures"
-
- DEFINE CLASS SystemTime as custom
- * SYSTEMTIME est composé de 8 WORD (soient 16 octets)
- #define SizeOfSystemTime 8*2
-
- cYear=SPACE(2)
- cMonth=SPACE(2)
- cDayOfWeek=SPACE(2)
- cDay=SPACE(2)
- cHour=SPACE(2)
- cMinute=SPACE(2)
- cSecond=SPACE(2)
- cMilliSec=SPACE(2)
-
- nYear=0
- nMonth=0
- nDayOfWeek=0
- nDay=0
- nHour=0
- nMinute=0
- nSecond=0
- nMilliSec=0
-
- tLocalDateTime=DATETIME()
- tUTCDateTime=DATETIME()
-
- FUNCTION Init
- ENDFUNC
-
- FUNCTION cYear_assign
- LPARAMETERS lcNewVal
- this.cYear=lcNewVal
- this.nYear=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cMonth_assign
- LPARAMETERS lcNewVal
- this.cMonth=lcNewVal
- this.nMonth=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cDayOfWeek_assign
- LPARAMETERS lcNewVal
- this.cDayOfWeek=lcNewVal
- this.nDayOfWeek=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cDay_assign
- LPARAMETERS lcNewVal
- this.cDay=lcNewVal
- this.nDay=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cHour_assign
- LPARAMETERS lcNewVal
- this.cHour=lcNewVal
- this.nHour=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cMinute_assign
- LPARAMETERS lcNewVal
- this.cDayOfWeek=lcNewVal
- this.nDayOfWeek=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cSecond_assign
- LPARAMETERS lcNewVal
- this.cSecond=lcNewVal
- this.nSecond=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION cMilliSec_assign
- LPARAMETERS lcNewVal
- this.cMilliSec=lcNewVal
- this.nMilliSec=this.strToWord(lcNewVal)
- ENDFUNC
-
- FUNCTION strToWord
- LPARAMETERS lcVal
- return ASC(LEFT(lcVal,1))+256*ASC(RIGHT(lcVal,1))
- ENDFUNC
-
- FUNCTION Destroy
- CLEAR DLLS "GetLocalTime","GetSystemTime"
- ENDFUNC
-
- PROCEDURE GetUTC
- LOCAL lcBuff
- lcBuff=REPLICATE(CHR(32), SizeOfSystemTime)
- DECLARE GetSystemTime IN WIN32API String@ pST
- GetSystemTime(@lcbuff)
- this.cYear=SUBSTR(lcBuff,1,2)
- this.cMonth=SUBSTR(lcBuff,3,2)
- this.cDayOfWeek=SUBSTR(lcBuff,5,2)
- this.cDay=SUBSTR(lcBuff,7,2)
- this.cHour=SUBSTR(lcBuff,9,2)
- this.cMinute=SUBSTR(lcBuff,11,2)
- this.cSecond=SUBSTR(lcBuff,13,2)
- this.cMilliSec=SUBSTR(lcBuff,15,2)
- ENDPROC
-
- PROCEDURE GetLocal
- LOCAL lcBuff
- DECLARE GetLocalTime IN WIN32API String@ pST
- lcBuff=REPLICATE(CHR(32), SizeOfSystemTime)
- GetLocalTime(@lcbuff)
- this.cYear=SUBSTR(lcBuff,1,2)
- this.cMonth=SUBSTR(lcBuff,3,2)
- this.cDayOfWeek=SUBSTR(lcBuff,5,2)
- this.cDay=SUBSTR(lcBuff,7,2)
- this.cHour=SUBSTR(lcBuff,9,2)
- this.cMinute=SUBSTR(lcBuff,11,2)
- this.cSecond=SUBSTR(lcBuff,13,2)
- this.cMilliSec=SUBSTR(lcBuff,15,2)
- ENDPROC
-
- FUNCTION DateTime
- WITH this
- RETURN DATETIME(.nYear, .nMonth, .nDay, .nHour, .nMinute, .nSecond)
- ENDWITH
- ENDFUNC
-
- ENDDEFINE
m.lcSt=CREATEOBJECT("SystemTime")
m.lcSt.GetUTC()
m.tUTC = m.lcSt.DateTime()
m.lcSt.GetLocal()
m.tLocal = m.lcSt.DateTime()
? m.tLocal-m.tUtc, "secondes d'écart entre UTC et Local"
? (m.tLocal-m.tUtc)/60, "minutes"
? (m.tLocal-m.tUtc)/3600, "heures"
DEFINE CLASS SystemTime as custom
* SYSTEMTIME est composé de 8 WORD (soient 16 octets)
#define SizeOfSystemTime 8*2
cYear=SPACE(2)
cMonth=SPACE(2)
cDayOfWeek=SPACE(2)
cDay=SPACE(2)
cHour=SPACE(2)
cMinute=SPACE(2)
cSecond=SPACE(2)
cMilliSec=SPACE(2)
nYear=0
nMonth=0
nDayOfWeek=0
nDay=0
nHour=0
nMinute=0
nSecond=0
nMilliSec=0
tLocalDateTime=DATETIME()
tUTCDateTime=DATETIME()
FUNCTION Init
ENDFUNC
FUNCTION cYear_assign
LPARAMETERS lcNewVal
this.cYear=lcNewVal
this.nYear=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cMonth_assign
LPARAMETERS lcNewVal
this.cMonth=lcNewVal
this.nMonth=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cDayOfWeek_assign
LPARAMETERS lcNewVal
this.cDayOfWeek=lcNewVal
this.nDayOfWeek=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cDay_assign
LPARAMETERS lcNewVal
this.cDay=lcNewVal
this.nDay=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cHour_assign
LPARAMETERS lcNewVal
this.cHour=lcNewVal
this.nHour=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cMinute_assign
LPARAMETERS lcNewVal
this.cDayOfWeek=lcNewVal
this.nDayOfWeek=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cSecond_assign
LPARAMETERS lcNewVal
this.cSecond=lcNewVal
this.nSecond=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION cMilliSec_assign
LPARAMETERS lcNewVal
this.cMilliSec=lcNewVal
this.nMilliSec=this.strToWord(lcNewVal)
ENDFUNC
FUNCTION strToWord
LPARAMETERS lcVal
return ASC(LEFT(lcVal,1))+256*ASC(RIGHT(lcVal,1))
ENDFUNC
FUNCTION Destroy
CLEAR DLLS "GetLocalTime","GetSystemTime"
ENDFUNC
PROCEDURE GetUTC
LOCAL lcBuff
lcBuff=REPLICATE(CHR(32), SizeOfSystemTime)
DECLARE GetSystemTime IN WIN32API String@ pST
GetSystemTime(@lcbuff)
this.cYear=SUBSTR(lcBuff,1,2)
this.cMonth=SUBSTR(lcBuff,3,2)
this.cDayOfWeek=SUBSTR(lcBuff,5,2)
this.cDay=SUBSTR(lcBuff,7,2)
this.cHour=SUBSTR(lcBuff,9,2)
this.cMinute=SUBSTR(lcBuff,11,2)
this.cSecond=SUBSTR(lcBuff,13,2)
this.cMilliSec=SUBSTR(lcBuff,15,2)
ENDPROC
PROCEDURE GetLocal
LOCAL lcBuff
DECLARE GetLocalTime IN WIN32API String@ pST
lcBuff=REPLICATE(CHR(32), SizeOfSystemTime)
GetLocalTime(@lcbuff)
this.cYear=SUBSTR(lcBuff,1,2)
this.cMonth=SUBSTR(lcBuff,3,2)
this.cDayOfWeek=SUBSTR(lcBuff,5,2)
this.cDay=SUBSTR(lcBuff,7,2)
this.cHour=SUBSTR(lcBuff,9,2)
this.cMinute=SUBSTR(lcBuff,11,2)
this.cSecond=SUBSTR(lcBuff,13,2)
this.cMilliSec=SUBSTR(lcBuff,15,2)
ENDPROC
FUNCTION DateTime
WITH this
RETURN DATETIME(.nYear, .nMonth, .nDay, .nHour, .nMinute, .nSecond)
ENDWITH
ENDFUNC
ENDDEFINE
Conclusion
vfp6 à 9
Historique
- 28 avril 2005 08:19:11 :
- côrecsion d'un fote hortografic
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Remplir une table avec tous les jours de l'année sous forme date [ par atarte ]
Bonjour,Voila j'ai besoin de constituer une table contenant tous les jours de l'année dans un champ nommé date. La perspéctive de devoir faire la mani
Mettre une date dans une clause WHERE d'une requête Visual Foxpro [ par artis31 ]
Bonjour,Je suis confronté à un problème sur une requête SELECT... WHERE... dans une table visual foxpro.A partir d'un code en VBA
vfp date francaise [ par samirba ]
Bonjour,Lors de la saisie des données dans une form le set date est French, après l'enregistrement dans la table et je fait un browse la dat
conversion date [ par ducker88 ]
Bonjour,Existe t'il une fonction foxpro qui permette de transformer une date du format JJ/MM/AAAA vers le format AAAA-MM-JJ ?duck88
probleme requete et date [au secours] [ par ducker88 ]
bonjour,Voila j'ai creer la requete suivante : select num_di,libe_di,date_dema where date_dema >={2006/01/19}et quand elle est executer elle f
datetime et SqlServer [ par zouheir_ali ]
Bonjour à tous,Je travaille avec vfp6 et sqlserver.dans une table sqlserver j'ai un champ de type datetime, une grille dans vfp est remplie avec une r
Manipulation de fichier texte [ par rr_style ]
Salut a tous Moi j'ai un serieux problème avec FoxPro j'ai développé une interface qui converti des données d'un logiciel vers un autre. grace à l
Date maximum dans une table [ par ducker88 ]
Bonjour à tous,J'ai une table dont la structure est la suivante :int num_cmd, float montant, date date_depDans cette table j'ai par exemple les valeur
champ date dépassé [ par ducker88 ]
Bonjour à tous,J'aimerai savoir à quoi peu t'on comparé un champ date qui aurait dépassé sa valeur maximale ?quand je la teste cela me renvoi { / /
divers [ par info_maroc ]
bonjour j'ai 2 questions1- j'utilise la fonction 'cdow' pour avoir le libellé jour par foi il me donne libellé en français et autre fois en anglais, e
|
Derniers Blogs
TFS INTEGRATION TOOLS - SUIVI DES SYNCHRONISATIONS AVEC REPORTING SERVICESTFS INTEGRATION TOOLS - SUIVI DES SYNCHRONISATIONS AVEC REPORTING SERVICES par vfabing
Afin de s'assurer du bon fonctionnement des différentes synchronisations effectuées par les TFS Integration Tools, 2 rapports sont présents dès l'installation. Il suffit alors d'effectuer les manipulations suivantes pour pouvoir les visualiser : Loca...
Cliquez pour lire la suite de l'article par vfabing CSS CONTENT STATE SELECTORS (PERSONNAL DRAFT)CSS CONTENT STATE SELECTORS (PERSONNAL DRAFT) par FREMYCOMPANY
Bonjour à tous, Je viens de publier une proposition comprenant 5 pseudo-classes pour le CSS Working Group ayant trait à l'état de chargement d'un élément (ex: IMG,VIDEO,AUDIO,OBJECT pour l'HTML.). Si le c½ur vous en dit, vous pouvez retrouver cette p...
Cliquez pour lire la suite de l'article par FREMYCOMPANY MBA : POURQUOI FAIRE ET COMMENT LE CHOISIR ?MBA : POURQUOI FAIRE ET COMMENT LE CHOISIR ? par ROMELARD Fabrice
Formation initiale Durant la formation, le découpage classique est le suivant (je donnerai les équivalences Suisse lorsque je les connaîtrais) : Ecole primaire jusqu'au Collège : Formation générale permettant d'obtenir les méthodes...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice Y'A DES ERREURS QUI PEUVENT RENDRE LE DéVELOPPEUR VIOLENTY'A DES ERREURS QUI PEUVENT RENDRE LE DéVELOPPEUR VIOLENT par Aleks
Quand on a ce genre d'erreur sans log :
Et bas on a juste envie de choper le gas de Microsoft qu'a développé ça et lui foutre des baffes de Coboye ! ...
Cliquez pour lire la suite de l'article par Aleks [HYPER-V 3] PRéSENTATION DES COMMANDLETS POWERSHELL[HYPER-V 3] PRéSENTATION DES COMMANDLETS POWERSHELL par Pierrick CATRO-BROUILLET
Avec la sortie prochaine de la Beta Consumer Preview de Windows 8, j'avais envie de revenir sur une des fonctionnalités que j'attends le plus et que, en bon geek que je suis, j'utilise déjà : Hyper-V 3 ainsi son module PowerShell.
Il y a déjà pléthor...
Cliquez pour lire la suite de l'article par Pierrick CATRO-BROUILLET
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|