1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub test()
MsgBox Date_Format(Date, 1)
End Sub
'
Function Date_Format(Fdate, mode)
Dim FDate2 As String
Dim Annee%, Mois%, Jour%, SepDate$
Fdate = FormatDateTime(Date, vbGeneralDate)
Annee = Year(Fdate): Mois = Month(Fdate): Jour =Day(Fdate)
If mode = 1 Then
With Application
Fdate = Replace(Fdate, Right("0" & Jour, 2), String(2, .International(xlDayCode)))
Fdate = Replace(Fdate, Right("0" & Mois, 2), String(2, .International(xlMonthCode)))
Fdate = Replace(Fdate, Right("00" & Annee, 4), String(4, .International(xlYearCode)))
End With
Else
Fdate = Replace(Fdate, Right("0" & Jour, 2), String(2, "d"))
Fdate = Replace(Fdate, Right("0" & Mois, 2), String(2, "m"))
Fdate = Replace(Fdate, Right("00" & Annee, 4), String(4, "y"))
End If
Date_Format = Fdate
'SepDate = Application.International(xlDateSeparator)
End Function |
Partager