Forum Liberty Basic France

Général » Nombre de Jours De date à date
Le 03/07/2022 à 13h27

Administrateur

Groupe: Administrateur

Inscrit le: 04/03/2012
Messages: 2489
Nombre de jours de date à date.
Modif le 04/06 à 11H34
Deux formats disponibles
M/J/A et: J/M/A
Code VB :
 
 
    NOMAINWIN
     mapw=350: maph= 300
    WindowWidth=mapw+15: WindowHeight=maph+40
    UpperLeftX = 10: UpperLeftY = 20
    mois$ = "Janvier Février Mars Avril Mai Juin Juillet Aout Septempbre Octobre Novembre Décenbre"
    today$ = date$("mm/dd/yyyy")
    j = date$(today$)
    jsem$ = word$("Mar Mer Jeu x Ven Sam x Dim Lun",int((j/7-int(j/7))*10)+1)
    date$ = jsem$+" "+mid$(today$,4,2)+" "+word$(mois$, val(today$))+" "+left$(time$(),5)'right$(today$,4)
    BUTTON #w.conv, "/", [conv], UL, 20, 35, 25, 25
    TEXTBOX  #w.deb, 20 , 70, 150, 30
    TEXTBOX  #w.fin, 190 , 70, 150, 30
    BUTTON #w.c, "C", [c], UL, 310, 35, 25, 25
    BUTTON #w.valdeb, "Valider", [valdeb], UL, 45, 110, 100, 25
    BUTTON #w.valfin, "Valider", [valfin], UL, 210, 110, 100, 25
    BUTTON #w.calc, "Calculer", [calc], UL, 125, 150, 100, 25
    TEXTBOX  #w.resu, 90 , 190, 170, 30
    TEXTBOX  #w.dat, 60 , 250, 250, 25
   GRAPHICBOX #w.g, 5, 5, mapw, maph
    OPEN "Jours de date à date" FOR window_nf AS #w
    #w, "TRAPCLOSE [closeHelp]"
    #w.deb, "!font courrier 14 bold": #w.fin, "!font courrier 14 bold": #w.resu, "!font courrier 14 bold"
    #w.valdeb, "!font courrier 12 bold": #w.valfin, "!font courrier 12 bold"
    #w.dat, "!font courrier 12 bold": #w.calc, "!font courrier 12 bold"
    #w.g, "down;fill darkpink;color white;backcolor darkpink"
    #w.g, "font courrier 12 bold"
    #w.g, "place 70 20": #w.g, "\Début": #w.g, "place 240 20": #w.g, "\Fin"
    #w.g, "place 110 50": #w.g, "\Mois / Jour / Année" : #w.g, "place 10 260": #w.g, "\Date:"
    #w.deb, "1/1/1901": #w.fin, "1/1/1901"
    #w.g, "flush"
    d$ = date$( ): dd$=right$(d$,4)
    date$= jsem$+" "+mid$(today$,4,2)+" "+word$(mois$, val(today$))+" "+dd$+"  "+left$(time$(),5)'********
    #w.dat, date$
    #w.calc, "!disable"
    c=1
  wait
  [conv]
    c=c+1: if c=3 then c=1
    if c=1 then conv=0
    if c=2 then conv=1
    if conv=0 then
      #w.g, "color darkpink;backcolor darkpink"
      #w.g, "place 105 30": #w.g, "boxfilled 270 55"
      #w.g, "color white;backcolor darkpink"
      #w.g, "place 110 50": #w.g, "\Mois / Jour / Année"
    end if
    if conv=1 then
      #w.g, "color darkpink;backcolor darkpink"
      #w.g, "place 105 30": #w.g, "boxfilled 270 55"
      #w.g, "color white;backcolor darkpink"
      #w.g, "place 110 50": #w.g, "\Jour / Mois / Année"
    end if
    #w.conv, word$("/ \",c)
  wait
  [c]
    #w.resu, ""
  wait
  [valdeb]
    #w.deb, "!contents? deb$": deb=val(deb$): #w.dat, "!contents? date$"
    jdeb=date$(deb$): d=1
    if conv=1 then
      jo$="": mo$="": d$=""
      an$=right$(deb$,4)
      for x=1 to 3
        jo$=jo$+mid$(deb$,x,1)
        if mid$(deb$,x,1)="/" then s1=x: exit for
      next x
      for x=s1+1 to s1+3
        mo$=mo$+mid$(deb$,x,1)
        if mid$(deb$,x,1)="/" then exit for
      next x
      d$=mo$+jo$+an$
      jdeb=date$(d$): d=1
    end if
    if d=1 and f=1 then #w.calc, "!enable"
  wait
  [valfin]
    #w.fin, "!contents? fin$": fin=val(fin$): #w.dat, "!contents? date$"
    jfin=date$(fin$): f=1
    if conv=1 then
      jo$="": mo$="": f$=""
      an$=right$(fin$,4)
      for x=1 to 3
        jo$=jo$+mid$(fin$,x,1)
        if mid$(fin$,x,1)="/" then s1=x: exit for
      next x
      for x=s1+1 to s1+3
        mo$=mo$+mid$(fin$,x,1)
        if mid$(fin$,x,1)="/" then exit for
      next x
      f$=mo$+jo$+an$
      jfin=date$(f$): f=1
    end if
    if d=1 and f=1 then #w.calc, "!enable"
  wait
  [calc]
    #w.resu, str$(jfin-jdeb);"  Jours": d=0: f=0
  wait
  [closeHelp]
    CLOSE  #w
    END
 
 
____________________
Roro

   
Le 11/07/2022 à 15h48

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 436
sympa !
____________________
Yo !

MSN Web    
Général » Nombre de Jours De date à date  

 |  |

1 Utilisateur en ligne : 0 Administrateur, 0 Modérateur, 0 Membre et 1 Visiteur
Utilisateur en ligne : Aucun membre connecté
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie