Accueil > > > CALCULER LE NOMBRE D'HEURES DE NUITS D'UN CRÉNEAU HORAIRE
CALCULER LE NOMBRE D'HEURES DE NUITS D'UN CRÉNEAU HORAIRE
Information sur la source
Description
Bonjour à tous Les fonctions temvern et nvertem sont les mêmes que dans l'une des contrib que j'avais postée qui s'appelle dift http://www.atoutfox.org/articles.asp?ACTION=FCON SULTER&ID=0000000066 Ici il s'agit de calculer le nombre d'heures de nuits, en partant d'une heure de début et une heure de fin Heuredeb et heurfin sont en caractère "HH:MM:SS" ex toto=heuresnut("10:00:00","23:00:00","22:00","07:0 0") retournera "01:00:00" A Améliorer : Des tests en entrée de fonction, afin de s'assurer que les paramètres sont bien en texte Bonne journée à tous Eric
Source
- function heuresnuit
- parameters hdeb,hfin,debnuit,finnuit
- **
- ** toto= heuresnuit(heurdeb, heurfin,"22:00","07:00")
- local retour,minuitdeb,minuitfin,hdeb,hfin;debnuit,finhuit,hfin31,retour
- minuitdeb=temvern("00:00")
- minuitfin=temvern("24:00")
- hdeb=temvern(left(hdeb,5))
- hfin=temvern(left(hfin,5))
- debnuit=temvern(debnuit)
- finnuit=temvern(finnuit)
- hfin31= minuitfin+finnuit
- retour=nvertem(0)
- do case
- case between(hdeb,debnuit,minuitfin) .and. between(hfin,debnuit,minuitfin)
- retour=nvertem(hfin-hdeb)
- case between(hdeb,minuitdeb,finnuit) .and. between(hfin,minuitdeb,finnuit)
- retour=nvertem(hfin-hdeb)
- case between(hdeb,debnuit,minuitfin) .and. between(hfin,minuitdeb,finnuit)
- retour=nvertem((minuitfin-hdeb)+hfin-minuitdeb)
- case between(hfin,debnuit,minuitfin) .and. hdeb <debnuit
- retour=nvertem(hfin-debnuit)
- case between(hfin,minuitdeb,finnuit) .and. hdeb <debnuit
- retour=nvertem(hfin-minuitdeb+ (minuitfin-debnuit))
- case hfin > finnuit .and. hfin<debnuit .and. between(hdeb,minuitdeb,finnuit)
- retour=nvertem(finnuit-hdeb)
- case hfin > finnuit .and. hfin<debnuit .and.between(hdeb,debnuit,minuitfin)
- retour=nvertem((finnuit-minuitdeb)+(minuitfin-hdeb))
- case hdeb<debnuit .and. hfin>finnuit .and. hfin<hdeb
- retour=nvertem((finnuit-minuitdeb)+(minuitfin-debnuit))
- case between(hfin,minuitfin,hfin31) .and. between(hdeb,debnuit,minuitfin)
- retour = nvertem(hfin-minuitfin +(minuitfin-hdeb))
- case between(hfin,minuitfin,hfin31).and. hdeb< debnuit .and. hdeb > finnuit
- retour = nvertem(hfin-minuitfin +(minuitfin-debnuit))
- case between(hfin,minuitfin,hfin31).and. hdeb< debnuit .and. hdeb <= finnuit
- retour = nvertem(hfin-minuitfin -(hdeb-minuitdeb))
-
-
- *-
- case hfin > hfin31 .and. between(hdeb,debnuit,minuitfin)
- retour = nvertem(finnuit-minuitfin +(minuitfin-hdeb))
- case hfin > hfin31 .and. hdeb< debnuit
- retour = nvertem(minuitfin-debnuit +(minuitfin-debnuit))
-
-
-
-
- endcase
- return righ(retour,5)+":00"
-
-
-
-
- function temvern
- parameters temp1
- temp1=alltrim(temp1)
- local s,m,h
- s=substr(temp1,len(temp1)-1,2)
- s=val(s)
- m=substr(temp1,len(temp1)-4,2)
- m=val(m)*60
- h=substr(temp1,1,len(temp1)-6)
- h=val(h)*3600
- retour=h+m+s
- return retour
-
-
- function nvertem
- parameters temp1
- local s,m,h
- h=int(temp1/3600)
- resth=mod(temp1,3600)
-
- m=int((resth)/60)
- restm=mod(m,60)
-
- s=int(mod(resth,60))
-
-
- return padl(h,5,"0")+":"+padl(m,2,"0")+":"+padl(s,2,"0")
-
function heuresnuit
parameters hdeb,hfin,debnuit,finnuit
**
** toto= heuresnuit(heurdeb, heurfin,"22:00","07:00")
local retour,minuitdeb,minuitfin,hdeb,hfin;debnuit,finhuit,hfin31,retour
minuitdeb=temvern("00:00")
minuitfin=temvern("24:00")
hdeb=temvern(left(hdeb,5))
hfin=temvern(left(hfin,5))
debnuit=temvern(debnuit)
finnuit=temvern(finnuit)
hfin31= minuitfin+finnuit
retour=nvertem(0)
do case
case between(hdeb,debnuit,minuitfin) .and. between(hfin,debnuit,minuitfin)
retour=nvertem(hfin-hdeb)
case between(hdeb,minuitdeb,finnuit) .and. between(hfin,minuitdeb,finnuit)
retour=nvertem(hfin-hdeb)
case between(hdeb,debnuit,minuitfin) .and. between(hfin,minuitdeb,finnuit)
retour=nvertem((minuitfin-hdeb)+hfin-minuitdeb)
case between(hfin,debnuit,minuitfin) .and. hdeb <debnuit
retour=nvertem(hfin-debnuit)
case between(hfin,minuitdeb,finnuit) .and. hdeb <debnuit
retour=nvertem(hfin-minuitdeb+ (minuitfin-debnuit))
case hfin > finnuit .and. hfin<debnuit .and. between(hdeb,minuitdeb,finnuit)
retour=nvertem(finnuit-hdeb)
case hfin > finnuit .and. hfin<debnuit .and.between(hdeb,debnuit,minuitfin)
retour=nvertem((finnuit-minuitdeb)+(minuitfin-hdeb))
case hdeb<debnuit .and. hfin>finnuit .and. hfin<hdeb
retour=nvertem((finnuit-minuitdeb)+(minuitfin-debnuit))
case between(hfin,minuitfin,hfin31) .and. between(hdeb,debnuit,minuitfin)
retour = nvertem(hfin-minuitfin +(minuitfin-hdeb))
case between(hfin,minuitfin,hfin31).and. hdeb< debnuit .and. hdeb > finnuit
retour = nvertem(hfin-minuitfin +(minuitfin-debnuit))
case between(hfin,minuitfin,hfin31).and. hdeb< debnuit .and. hdeb <= finnuit
retour = nvertem(hfin-minuitfin -(hdeb-minuitdeb))
*-
case hfin > hfin31 .and. between(hdeb,debnuit,minuitfin)
retour = nvertem(finnuit-minuitfin +(minuitfin-hdeb))
case hfin > hfin31 .and. hdeb< debnuit
retour = nvertem(minuitfin-debnuit +(minuitfin-debnuit))
endcase
return righ(retour,5)+":00"
function temvern
parameters temp1
temp1=alltrim(temp1)
local s,m,h
s=substr(temp1,len(temp1)-1,2)
s=val(s)
m=substr(temp1,len(temp1)-4,2)
m=val(m)*60
h=substr(temp1,1,len(temp1)-6)
h=val(h)*3600
retour=h+m+s
return retour
function nvertem
parameters temp1
local s,m,h
h=int(temp1/3600)
resth=mod(temp1,3600)
m=int((resth)/60)
restm=mod(m,60)
s=int(mod(resth,60))
return padl(h,5,"0")+":"+padl(m,2,"0")+":"+padl(s,2,"0")
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
horloge en foxpro [ par engelina33 ]
Bonsoir,y'a t'il quelqu'un qui peut m'indiquer un moyen pour afficher une horloge et donnez la main à l'utilisateur de sélectionné une heure et me ret
|
Derniers Blogs
[TOOLS] NDEPEND 3 DANS VISUAL STUDIO, WAAAAAAAOU!!![TOOLS] NDEPEND 3 DANS VISUAL STUDIO, WAAAAAAAOU!!! par JeremyJeanson
NDepend passé en version 3. Comme pour toute version majeur, la version 3 a son lots de nouveautés : performances, fonctionnalités accrues . etc . Mais dans tout cela il y a la fonctionnalité qui dénote. Le petit truc qui fait que NDepend me fait dire Waa...
Cliquez pour lire la suite de l'article par JeremyJeanson [WF4] GROSSES MéPRISES EN PERSPECTIVE SUR LE KIT DE MIGRATION WF3->WF4[WF4] GROSSES MéPRISES EN PERSPECTIVE SUR LE KIT DE MIGRATION WF3->WF4 par JeremyJeanson
Comme un certain nombre de fanatiques des flux RSS, je suis avec grand intérêt les articles de la team WCF/WF et forcément l'annonce d'hier concernant un kit de migration WF3->WF4 m'a fait chaud au c½ur ;) (pour rappel, mon post au sujet de la migratio...
Cliquez pour lire la suite de l'article par JeremyJeanson RéUNION DU CLUB MOSS PARISRéUNION DU CLUB MOSS PARIS par VANNESTE Xavier
Bonjour à tous la réunion du club moss aura lieu le 15 mars 2010 à 14 heures:
14:00 - 14:05 Paris, EROL GIRAUDY + Gaetan BOUVERET + Nicolas Georgeault intro Présentateur : Pierre Erol GIRAUDY14:05 - 14:30 Paris, Worflow - visio Services - We...
Cliquez pour lire la suite de l'article par VANNESTE Xavier [WF4] ARGUMENT, QUI ES TU?[WF4] ARGUMENT, QUI ES TU? par JeremyJeanson
Quand je parle de Workflows ou d'activités (au passage, il s'agit de la même chose dans WF4 ;) ), je fais souvent la comparaison avec une méthode classique : Une activité peut avoir un retour, comme une méthode. Une activité peut avoir des arguments d'ent...
Cliquez pour lire la suite de l'article par JeremyJeanson [FAST] FORMATIONS GRATUITES EN E-LEARNING[FAST] FORMATIONS GRATUITES EN E-LEARNING par pierre
Bonjour, Quelques formations gratuites sur FAST: Developer Configuring Search UIs Presentation 37 minutes La...
Cliquez pour lire la suite de l'article par pierre
Forum
RE : TXT VERS DBFRE : TXT VERS DBF par MichelAtoutFox
Cliquez pour lire la suite par MichelAtoutFox RE : TXT VERS DBFRE : TXT VERS DBF par MichelAtoutFox
Cliquez pour lire la suite par MichelAtoutFox
Logiciels
Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods Konvertor (4.00)KONVERTOR (4.00)Le logiciel est un gestionnaire multimedia affichant, jouant et convertissant plus de 2000 format... Cliquez pour télécharger Konvertor Xlite (v 3.0 build 41150)XLITE (V 3.0 BUILD 41150)c'est un logiciel qui permet de téléphoner par Internet à l'aide d'un compte SIP pratique pour le... Cliquez pour télécharger Xlite Academy System (10.9.3.0)ACADEMY SYSTEM (10.9.3.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Pacmin (1.1.0)PACMIN (1.1.0)Adaptation du célèbre jeu d'arcade. Incarnez une équipe de fantômes ou de pacmans et détruisez vo... Cliquez pour télécharger Pacmin
|