J JDH XLDnaute Nouveau 10 Juin 2008 #1 Slt Voila un bon moment que je planche sur le format dla date J'aimerai mettre une variable en format yyyy-mm-dd Code: Dim MaDate as Date Madate = Format(Date, "yyyy-mm-dd") EH voilà !!! ne fonctionne pas du tout. IL met tjrs la date en format fra => dd-mm-yyyy Merci des aides!
Slt Voila un bon moment que je planche sur le format dla date J'aimerai mettre une variable en format yyyy-mm-dd Code: Dim MaDate as Date Madate = Format(Date, "yyyy-mm-dd") EH voilà !!! ne fonctionne pas du tout. IL met tjrs la date en format fra => dd-mm-yyyy Merci des aides!
Kero XLDnaute Junior 10 Juin 2008 #2 Re : Format Date Salut Essai de mettre : Dim MaDate As Variant @ + Vote positif 0 Vote négatif
J JDH XLDnaute Nouveau 10 Juin 2008 #3 Re : Format Date Yep Ca marche avec le type Variant Mais le probléme C'est qu'aprés j'aimerai retrancher 1 jour via la variable NewDate Code: Dim MaDate as Variant Dim Newdate as Variant Madate = Format(Date, "yyyy-mm-dd") NewDate=MaDate - 1 Le prog bugg a la ligne : NewDate=MaDate - 1 Vote positif 0 Vote négatif
Re : Format Date Yep Ca marche avec le type Variant Mais le probléme C'est qu'aprés j'aimerai retrancher 1 jour via la variable NewDate Code: Dim MaDate as Variant Dim Newdate as Variant Madate = Format(Date, "yyyy-mm-dd") NewDate=MaDate - 1 Le prog bugg a la ligne : NewDate=MaDate - 1
Kero XLDnaute Junior 10 Juin 2008 #4 Re : Format Date Re Jdh Voila un pti truc j'espere avoir pigé Code: Sub testjdh() Dim MaDate As Variant Dim NewDate As Date NewDate = Format(Date, "dd-mm-yyyy") MaDate = NewDate - 1 MaDate = Format(MaDate, "yyyy-mm-dd") MsgBox (MaDate) End Sub Vote positif 0 Vote négatif
Re : Format Date Re Jdh Voila un pti truc j'espere avoir pigé Code: Sub testjdh() Dim MaDate As Variant Dim NewDate As Date NewDate = Format(Date, "dd-mm-yyyy") MaDate = NewDate - 1 MaDate = Format(MaDate, "yyyy-mm-dd") MsgBox (MaDate) End Sub
Pierrot93 XLDnaute Barbatruc 10 Juin 2008 #5 Re : Format Date Bonsoir jdh, Kero une autre solution, en utilisant la fonction "cdate" : bonne soirée @+ edition : erreur sur le format, désolé... Vote positif 0 Vote négatif
Re : Format Date Bonsoir jdh, Kero une autre solution, en utilisant la fonction "cdate" : bonne soirée @+ edition : erreur sur le format, désolé...
Pierrot93 XLDnaute Barbatruc 10 Juin 2008 #6 Re : Format Date Re sinon ceci devrait également faire l'affaire, fonctionne chez moi : Code: Dim MaDate As Date, newdate As Date MaDate = Date newdate = MaDate - 1 MsgBox Format(newdate, "yyyy-mm-dd") @+ Vote positif 0 Vote négatif
Re : Format Date Re sinon ceci devrait également faire l'affaire, fonctionne chez moi : Code: Dim MaDate As Date, newdate As Date MaDate = Date newdate = MaDate - 1 MsgBox Format(newdate, "yyyy-mm-dd") @+
Kero XLDnaute Junior 10 Juin 2008 #7 Re : Format Date Bonjour Pierrot Ah oui comme ça, c'est plus simple aussi @+ Vote positif 0 Vote négatif
J JDH XLDnaute Nouveau 10 Juin 2008 #8 Re : Format Date OUe ca marche . MERci Mais pq ce code la ne marche pas ..?/ Code: Dim MaDate As Date, newdate As Date MaDate = Date newdate = MaDate - 1 newdate = Format(newdate, "yyyy-mm-dd") MsgBox newdate Vote positif 0 Vote négatif
Re : Format Date OUe ca marche . MERci Mais pq ce code la ne marche pas ..?/ Code: Dim MaDate As Date, newdate As Date MaDate = Date newdate = MaDate - 1 newdate = Format(newdate, "yyyy-mm-dd") MsgBox newdate
Pierrot93 XLDnaute Barbatruc 10 Juin 2008 #9 Re : Format Date Re regarde ci dessous, extrait de l'aide vba : Les variables de type Date affichent les dates au format de date abrégé reconnu par votre ordinateur. Cliquez pour agrandir... @+ Vote positif 0 Vote négatif
Re : Format Date Re regarde ci dessous, extrait de l'aide vba : Les variables de type Date affichent les dates au format de date abrégé reconnu par votre ordinateur. Cliquez pour agrandir... @+
J JDH XLDnaute Nouveau 10 Juin 2008 #10 Re : Format Date Ah ok XD C trop dla balle Allez Merci Forum +++ Vote positif 0 Vote négatif