Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

formats de dates

3 réponses
Avatar
j
Bonjour,

Petit problème de dates.
Je baigne dans les flux RSS. En UTF-8, les dates sont affichées sous la
forme : Mon, 18 Feb 2008 19:16:50 +0100 (dans le meilleur des cas).
Y a-t-il un moyen simple en VBA pour convertir une date de ce type en date
Excel ?
J'ai bien bricolé un truc en retirant la partie gauche (jour) et la partie
droite (le décalage horaire) et en remplaçant "Feb" par "fév"...
(et en prévoyant le cas où la date est en "02-18-2008")
Ca marche, mais ça n'est vraiment pas propre... (et puis si j'ai une heure
de Californie...)

Si vous connaissez une fonction ad hoc, je suis preneur !
d'avance merci

j@c
http://jacxl.free.fr

3 réponses

Avatar
j
je copie la réponse de FxM ci-dessous, et je teste :

19 Feb 2008 13:51
FxM

Ton message sur MPFE
Bonjour Jacques,
Je ne peux pour l'instant me connecter en NNTP.
Une fonction développée pour transformer ce genre de date.
@+
FxM

Public Function decode_date(entree, Optional opt, Optional forma)
'transforme ...
'Mon, 2 may 2006 18:20:32 +0200
'en ... heure GMT sous forme connue d'Excel
'02/05/2006 16:20:32
'Stop
Dim tablo_mois, tablo_heure, result_dat, result_heure, entree_vraie
Dim heure As Integer, minute As Integer, x As Integer
entree_vraie = entree
On Error GoTo fin:
If Left(entree, 1) = " " Then entree = Right(entree, Len(entree) - 1)
If Not IsNumeric(Left(entree, 1)) Then entree = Right(entree, Len(entree) -
InStr(1, entree, " "))
tablo_mois = Split(entree, " ")
Select Case UCase(tablo_mois(1))
Case "JAN", "JANUARY", "JANVIER": tablo_mois(1) = 1
Case "FEB", "FEBRUARY", "FEVRIER": tablo_mois(1) = 2
Case "MAR", "MARCH", "MARS": tablo_mois(1) = 3
Case "APR", "APRIL", "AVRIL": tablo_mois(1) = 4
Case "MAY", "MAI": tablo_mois(1) = 5
Case "JUN", "JUNE", "JUIN": tablo_mois(1) = 6
Case "JUL", "JULY", "JUILLET": tablo_mois(1) = 7
Case "AUG", "AUGUST", "AOUT", "AOÛT": tablo_mois(1) = 8
Case "SEP", "SEPTEMBER", "SEPTEMBRE": tablo_mois(1) = 9
Case "OCT", "OCTOBER", "OCTOBRE": tablo_mois(1) = 10
Case "NOV", "NOVEMBER", "NOVEMBRE": tablo_mois(1) = 11
Case "DEC", "DECEMBER", "DECEMBRE", UCase("Décembre"): tablo_mois(1) = 12
End Select
tablo_heure = Split(tablo_mois(3), ":")
result_dat = DateSerial(CInt(tablo_mois(2)), CInt(tablo_mois(1)),
CInt(tablo_mois(0)))
result_heure = TimeSerial(CInt(tablo_heure(0)), CInt(tablo_heure(1)),
CInt(tablo_heure(2)))
If UBound(tablo_mois) = 3 Then
heure = 0: minute = 0: x = 0
Else
If InStr(1, UCase(tablo_mois(4)), "GMT") > 0 Then
heure = 0: minute = 0: x = 0
Else
heure = CInt(Mid(tablo_mois(4), 2, 2)): minute = CInt(Mid(tablo_mois(4), 4,
2))
Select Case Left(tablo_mois(4), 1)
Case "+": x = -1
Case "-": x = 1
Case Else
End Select
End If
End If
'Stop
forma = Application.Substitute(forma, "a", "y")
forma = Application.Substitute(forma, "j", "d")
decode_date = Format(result_dat + result_heure + x * (heure / 24 + minute /
24 / 60), forma)
Exit Function
fin:
decode_date = entree_vraie
On Error GoTo 0
End Function



"" a écrit dans le message de news:

Bonjour,

Petit problème de dates.
Je baigne dans les flux RSS. En UTF-8, les dates sont affichées sous la
forme : Mon, 18 Feb 2008 19:16:50 +0100 (dans le meilleur des cas).
Y a-t-il un moyen simple en VBA pour convertir une date de ce type en date
Excel ?
J'ai bien bricolé un truc en retirant la partie gauche (jour) et la partie
droite (le décalage horaire) et en remplaçant "Feb" par "fév"...
(et en prévoyant le cas où la date est en "02-18-2008")
Ca marche, mais ça n'est vraiment pas propre... (et puis si j'ai une heure
de Californie...)

Si vous connaissez une fonction ad hoc, je suis preneur !
d'avance merci


http://jacxl.free.fr







Avatar
j
resalut FxM
j'ai testé ta formule magique sur un paquet de dates que j'ai rencontrées
dans les RSS ;

MsgBox decode_date("Tue, 19 Feb 2008 19:01:26 Etc/GMT")
MsgBox decode_date("Tue, 19 Feb 2008 15:59:05 GMT")
MsgBox decode_date("2008-02-19T15:01:38-05:00")
MsgBox decode_date("Tue, 12 Feb 2008 12:56:30 -0600")
MsgBox decode_date("2/19/2008 12:27:43 PM")
MsgBox decode_date("Tue, 19 Feb 2008 16:31:00 GMT")
MsgBox decode_date("Fri, 15 Feb 2008 11:42 PST")
MsgBox decode_date("Tue, 19 Feb 2008 13:14 EST")

aucune idée de comment on convertit EST ou PST en GTM (je sens qu'il va
falloir ajouter un autre tableau de conversion.)...
quant à la traduction de 5/2/2008 en 2 mai plutot qu'en 5 février (on est en
anglais, en général, mais pas toujours)...
et puis les machins du genre "2008-02-19T15:01:38-05:00"...

je crains qu'il n'y ait plus qu'à attendre un peu de discipline de la part
des éditeurs de flux (on peut rêver !)





"" a écrit dans le message de news:

je copie la réponse de FxM ci-dessous, et je teste :

19 Feb 2008 13:51
FxM

Ton message sur MPFE
Bonjour Jacques,
Je ne peux pour l'instant me connecter en NNTP.
Une fonction développée pour transformer ce genre de date.
@+
FxM

Public Function decode_date(entree, Optional opt, Optional forma)
'transforme ...
'Mon, 2 may 2006 18:20:32 +0200
'en ... heure GMT sous forme connue d'Excel
'02/05/2006 16:20:32
'Stop
Dim tablo_mois, tablo_heure, result_dat, result_heure, entree_vraie
Dim heure As Integer, minute As Integer, x As Integer
entree_vraie = entree
On Error GoTo fin:
If Left(entree, 1) = " " Then entree = Right(entree, Len(entree) - 1)
If Not IsNumeric(Left(entree, 1)) Then entree = Right(entree,
Len(entree) -

InStr(1, entree, " "))
tablo_mois = Split(entree, " ")
Select Case UCase(tablo_mois(1))
Case "JAN", "JANUARY", "JANVIER": tablo_mois(1) = 1
Case "FEB", "FEBRUARY", "FEVRIER": tablo_mois(1) = 2
Case "MAR", "MARCH", "MARS": tablo_mois(1) = 3
Case "APR", "APRIL", "AVRIL": tablo_mois(1) = 4
Case "MAY", "MAI": tablo_mois(1) = 5
Case "JUN", "JUNE", "JUIN": tablo_mois(1) = 6
Case "JUL", "JULY", "JUILLET": tablo_mois(1) = 7
Case "AUG", "AUGUST", "AOUT", "AOÛT": tablo_mois(1) = 8
Case "SEP", "SEPTEMBER", "SEPTEMBRE": tablo_mois(1) = 9
Case "OCT", "OCTOBER", "OCTOBRE": tablo_mois(1) = 10
Case "NOV", "NOVEMBER", "NOVEMBRE": tablo_mois(1) = 11
Case "DEC", "DECEMBER", "DECEMBRE", UCase("Décembre"): tablo_mois(1) = 12
End Select
tablo_heure = Split(tablo_mois(3), ":")
result_dat = DateSerial(CInt(tablo_mois(2)), CInt(tablo_mois(1)),
CInt(tablo_mois(0)))
result_heure = TimeSerial(CInt(tablo_heure(0)), CInt(tablo_heure(1)),
CInt(tablo_heure(2)))
If UBound(tablo_mois) = 3 Then
heure = 0: minute = 0: x = 0
Else
If InStr(1, UCase(tablo_mois(4)), "GMT") > 0 Then
heure = 0: minute = 0: x = 0
Else
heure = CInt(Mid(tablo_mois(4), 2, 2)): minute = CInt(Mid(tablo_mois(4),
4,

2))
Select Case Left(tablo_mois(4), 1)
Case "+": x = -1
Case "-": x = 1
Case Else
End Select
End If
End If
'Stop
forma = Application.Substitute(forma, "a", "y")
forma = Application.Substitute(forma, "j", "d")
decode_date = Format(result_dat + result_heure + x * (heure / 24 + minute
/

24 / 60), forma)
Exit Function
fin:
decode_date = entree_vraie
On Error GoTo 0
End Function



"" a écrit dans le message de news:

Bonjour,

Petit problème de dates.
Je baigne dans les flux RSS. En UTF-8, les dates sont affichées sous la
forme : Mon, 18 Feb 2008 19:16:50 +0100 (dans le meilleur des cas).
Y a-t-il un moyen simple en VBA pour convertir une date de ce type en
date


Excel ?
J'ai bien bricolé un truc en retirant la partie gauche (jour) et la
partie


droite (le décalage horaire) et en remplaçant "Feb" par "fév"...
(et en prévoyant le cas où la date est en "02-18-2008")
Ca marche, mais ça n'est vraiment pas propre... (et puis si j'ai une
heure


de Californie...)

Si vous connaissez une fonction ad hoc, je suis preneur !
d'avance merci


http://jacxl.free.fr











Avatar
FxM
Hello ,

Le code qui suit semble fonctionner avec les exemples cités (testé sur
XL2002).
Comme d'hab, attention aux coupures de ligne ...

@+
FxM


Public Function decode_date2(entree, Optional forma)
Dim entree_vraie 'retour de la saisie si problème
Dim tag1 As Boolean 'vrai de date = structure trouvée
Dim ye As Integer 'annee
Dim mo As Integer 'mois
Dim da As Integer 'jour
Dim he As Integer 'heure
Dim mi As Integer 'minute
Dim se As Integer 'seconde
Dim si As Integer 'signe du décalage horaire
Dim dh As Integer 'décalage des heures / GMT
Dim dm As Integer 'decalage des minutes / GMT
Dim ok As Boolean 'vérification d'un type de date (bcp de conditions)

'dans l'ordre d'apparition ...
Dim ps1 As Integer 'position du 1er slatch / dans la date
Dim ps2 As Integer 'position du 2e slatch / dans la date
Dim pe1 As Integer 'position du 1er espace dans la date
Dim pp1 As Integer 'position du 1er point . dans la date
Dim pp2 As Integer 'position du 2e point . dans la date
Dim pe2 As Integer 'position du 2e espace dans la date

Dim tablo_mois '1er tableu de séparation (pour la date)
Dim tablo_heure '2e tableau de séparation (pour l'heure)

'notons la date s'il y a un problème
entree_vraie = entree

'en cas d'erreur -> aller à la fin et retourner la date saisie
On Error GoTo fin:

'tag1 = false si aucun cas valide trouvé
tag1 = False

'vérification des différents cas de l'ISO 8601
'YYYY (eg 1997)
'YYYY-MM (eg 1997-07)
'YYYY-MM-DD (eg 1997-07-16)
'YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
'YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
'YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
'where
'YYYY = four-digit year
'MM = two-digit month (01=January, etc.)
'DD = two-digit day of month (01 through 31)
'hh = two digits of hour (00 through 23) (am/pm NOT allowed)
'mm = two digits of minute (00 through 59)
'ss = two digits of second (00 through 59)
's = one or more digits representing a decimal fraction of a second
'TZD = time zone designator (Z or +hh:mm or -hh:mm)

'YYYY (eg 1997) ???
If entree Like "????" And tag1 = False Then
ye = CInt(entree)
mo = 1: da = 1: he = 0: mi = 0: se = 0: si = 0: dh = 0: dm = 0
tag1 = True
End If

'YYYY-MM (eg 1997-07)
If entree Like "????-??" And tag1 = False Then
ye = CInt(Mid(entree, 1, 4))
mo = CInt(Mid(entree, 6, 2))
da = 1: he = 0: mi = 0: se = 0: si = 0: dh = 0: dm = 0
tag1 = True
End If

'YYYY-MM-DD (eg 1997-07-16)
If entree Like "????-??-??" And tag1 = False Then
ye = CInt(Mid(entree, 1, 4))
mo = CInt(Mid(entree, 6, 2))
da = CInt(Mid(entree, 9, 2))
he = 0: mi = 0: se = 0: si = 0: dh = 0: dm = 0
tag1 = True
End If

'YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
If (entree Like "????-??-??T??:?????:??" Or entree Like
"????-??-??T??:??Z") And tag1 = False Then
ye = CInt(Mid(entree, 1, 4))
mo = CInt(Mid(entree, 6, 2))
da = CInt(Mid(entree, 9, 2))
he = CInt(Mid(entree, InStr(1, entree, "T") + 1, 2))
mi = CInt(Mid(entree, InStr(1, entree, "T") + 4, 2))
se = 0
If Right(entree, 1) = "Z" Then
si = 0: dh = 0: dm = 0
Else
si = CInt(Mid(StrReverse(entree), 6, 1) & "1")
dh = CInt(Mid(StrReverse(entree), 5, 2))
dm = CInt(Mid(StrReverse(entree), 2, 2))
End If
tag1 = True
End If

'YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
If (entree Like "????-??-??T??:??:?????:??" Or entree Like
"????-??-??T??:??:??Z") And tag1 = False Then
ye = CInt(Mid(entree, 1, 4))
mo = CInt(Mid(entree, 6, 2))
da = CInt(Mid(entree, 9, 2))
he = CInt(Mid(entree, InStr(1, entree, "T") + 1, 2))
mi = CInt(Mid(entree, InStr(1, entree, "T") + 4, 2))
se = CInt(Mid(entree, InStr(1, entree, "T") + 7, 2))
If Right(entree, 1) = "Z" Then
si = 0: dh = 0: dm = 0
Else
si = CInt(Mid(StrReverse(entree), 6, 1) & "1")
dh = CInt(Mid(StrReverse(entree), 5, 2))
dm = CInt(Mid(StrReverse(entree), 1, 2))
End If
tag1 = True
End If

'YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
ok = False
ok = ok Or entree Like "????-??-??T??:??:??.?????:??"
ok = ok Or entree Like "????-??-??T??:??:??.????:??"
ok = ok Or entree Like "????-??-??T??:??:??.??Z"
ok = ok Or entree Like "????-??-??T??:??:??.?Z"

If ok And tag1 = False Then
ye = CInt(Mid(entree, 1, 4))
mo = CInt(Mid(entree, 6, 2))
da = CInt(Mid(entree, 9, 2))
he = CInt(Mid(entree, InStr(1, entree, "T") + 1, 2))
mi = CInt(Mid(entree, InStr(1, entree, "T") + 4, 2))
se = CInt(Mid(entree, InStr(1, entree, "T") + 7, 2))
If Right(entree, 1) = "Z" Then
si = 0: dh = 0: dm = 0
Else
si = CInt(Mid(StrReverse(entree), 6, 1) & "1")
dh = CInt(Mid(StrReverse(entree), 5, 2))
dm = CInt(Mid(StrReverse(entree), 2, 2))
End If
End If


'cas ne suivant pas l'ISO8601
'enlever les éventuels premiers espaces
Do Until Left(entree, 1) <> " "
entree = Right(entree, Len(entree) - 1)
Loop

'remplacer les mentions bizarres
entree = Application.Substitute(entree, " Etc/", " ")
If Right(entree, 4) = " PST" Then entree = Left(entree, Len(entree) -
4) & " -0500"
If Right(entree, 4) = " EST" Then entree = Left(entree, Len(entree) -
4) & " -0800"
If Right(entree, 4) = " GMT" Then entree = Left(entree, Len(entree) -
4) & " +0000"

'cas : 2/19/2008 12:27:43 PM
If Len(entree) - Len(Application.Substitute(entree, "/", "")) = 2 And _
Len(entree) - Len(Application.Substitute(entree, ":", "")) = 2 And _
(UCase(Right(entree, 2)) = "PM" Or UCase(Right(entree, 2)) = "AM")
And tag1 = False Then
ps1 = InStr(1, entree, "/")
ps2 = InStr(ps1 + 1, entree, "/")
pe1 = InStr(ps2 + 1, entree, " ")
pp1 = InStr(pe1 + 1, entree, ":")
pp2 = InStr(pp1 + 1, entree, ":")
pe2 = InStr(pp2 + 1, entree, " ")
da = CInt(Mid(entree, ps1 + 1, ps2 - ps1 - 1))
mo = CInt(Mid(entree, 1, ps1 - 1))
ye = CInt(Mid(entree, ps2 + 1, pe1 - ps2 - 1))
he = CInt(Mid(entree, pe1 + 1, pp1 - pe1 - 1)): If he = 12 Then he = 0
mi = CInt(Mid(entree, pp1 + 1, pp2 - pp1 - 1))
se = CInt(Mid(entree, pp2 + 1, pe2 - pp2 - 1))
Select Case UCase(Right(entree, 2))
Case "PM": he = he + 12
Case "AM"
Case Else: Exit Function
End Select
si = 0: dh = 0: dm = 0
tag1 = True
End If

If tag1 = False Then
'enlever l'éventuelle mention de jour "Tue," ...
If Not IsNumeric(Left(entree, 1)) Then
entree = Right(entree, Len(entree) - InStr(1, entree, " "))
End If

tablo_mois = Split(entree, " ")
Select Case UCase(tablo_mois(1))
Case "JAN", "JANUARY", "JANVIER": mo = 1
Case "FEB", "FEBRUARY", "FEVRIER": mo = 2
Case "MAR", "MARCH", "MARS": mo = 3
Case "APR", "APRIL", "AVRIL": mo = 4
Case "MAY", "MAI": mo = 5
Case "JUN", "JUNE", "JUIN": mo = 6
Case "JUL", "JULY", "JUILLET": mo = 7
Case "AUG", "AUGUST", "AOUT", "AOÛT": mo = 8
Case "SEP", "SEPTEMBER", "SEPTEMBRE": mo = 9
Case "OCT", "OCTOBER", "OCTOBRE": mo = 10
Case "NOV", "NOVEMBER", "NOVEMBRE": mo = 11
Case "DEC", "DECEMBER", "DECEMBRE", UCase("Décembre"): mo = 12
End Select
'Stop
If UBound(Split(tablo_mois(3), ":")) = 1 Then tablo_mois(3) =
tablo_mois(3) & ":00"
tablo_heure = Split(tablo_mois(3), ":")
ye = CInt(tablo_mois(2))
da = CInt(tablo_mois(0))
he = CInt(tablo_heure(0))
mi = CInt(tablo_heure(1))
se = CInt(tablo_heure(2))

If UBound(tablo_mois) = 3 Then
si = 0: dh = 0: dm = 0
Else
If InStr(1, UCase(tablo_mois(4)), "GMT") > 0 Then
si = 0: dh = 0: dm = 0
Else
dh = CInt(Mid(tablo_mois(4), 2, 2))
dm = CInt(Mid(tablo_mois(4), 4, 2))
si = CInt(Left(tablo_mois(4), 1) & "1")
End If
End If
tag1 = True
End If

If tag1 = False Then Exit Function

forma = Application.Substitute(forma, "a", "y")
forma = Application.Substitute(forma, "j", "d")
decode_date2 = Format(DateSerial(ye, mo, da) + TimeSerial(he, mi, se)
- si * (dh / 24 + dm / 24 / 60), forma)
Exit Function

fin:
decode_date2 = entree_vraie
On Error GoTo 0
End Function



resalut FxM
j'ai testé ta formule magique sur un paquet de dates que j'ai rencontrées
dans les RSS ;

MsgBox decode_date("Tue, 19 Feb 2008 19:01:26 Etc/GMT")
MsgBox decode_date("Tue, 19 Feb 2008 15:59:05 GMT")
MsgBox decode_date("2008-02-19T15:01:38-05:00")
MsgBox decode_date("Tue, 12 Feb 2008 12:56:30 -0600")
MsgBox decode_date("2/19/2008 12:27:43 PM")
MsgBox decode_date("Tue, 19 Feb 2008 16:31:00 GMT")
MsgBox decode_date("Fri, 15 Feb 2008 11:42 PST")
MsgBox decode_date("Tue, 19 Feb 2008 13:14 EST")

aucune idée de comment on convertit EST ou PST en GTM (je sens qu'il va
falloir ajouter un autre tableau de conversion.)...
quant à la traduction de 5/2/2008 en 2 mai plutot qu'en 5 février (on est en
anglais, en général, mais pas toujours)...
et puis les machins du genre "2008-02-19T15:01:38-05:00"...

je crains qu'il n'y ait plus qu'à attendre un peu de discipline de la part
des éditeurs de flux (on peut rêver !)





"" a écrit dans le message de news:

je copie la réponse de FxM ci-dessous, et je teste :

19 Feb 2008 13:51
FxM

Ton message sur MPFE
Bonjour Jacques,
Je ne peux pour l'instant me connecter en NNTP.
Une fonction développée pour transformer ce genre de date.
@+
FxM

Public Function decode_date(entree, Optional opt, Optional forma)
'transforme ...
'Mon, 2 may 2006 18:20:32 +0200
'en ... heure GMT sous forme connue d'Excel
'02/05/2006 16:20:32
'Stop
Dim tablo_mois, tablo_heure, result_dat, result_heure, entree_vraie
Dim heure As Integer, minute As Integer, x As Integer
entree_vraie = entree
On Error GoTo fin:
If Left(entree, 1) = " " Then entree = Right(entree, Len(entree) - 1)
If Not IsNumeric(Left(entree, 1)) Then entree = Right(entree,
Len(entree) -

InStr(1, entree, " "))
tablo_mois = Split(entree, " ")
Select Case UCase(tablo_mois(1))
Case "JAN", "JANUARY", "JANVIER": tablo_mois(1) = 1
Case "FEB", "FEBRUARY", "FEVRIER": tablo_mois(1) = 2
Case "MAR", "MARCH", "MARS": tablo_mois(1) = 3
Case "APR", "APRIL", "AVRIL": tablo_mois(1) = 4
Case "MAY", "MAI": tablo_mois(1) = 5
Case "JUN", "JUNE", "JUIN": tablo_mois(1) = 6
Case "JUL", "JULY", "JUILLET": tablo_mois(1) = 7
Case "AUG", "AUGUST", "AOUT", "AOÛT": tablo_mois(1) = 8
Case "SEP", "SEPTEMBER", "SEPTEMBRE": tablo_mois(1) = 9
Case "OCT", "OCTOBER", "OCTOBRE": tablo_mois(1) = 10
Case "NOV", "NOVEMBER", "NOVEMBRE": tablo_mois(1) = 11
Case "DEC", "DECEMBER", "DECEMBRE", UCase("Décembre"): tablo_mois(1) = 12
End Select
tablo_heure = Split(tablo_mois(3), ":")
result_dat = DateSerial(CInt(tablo_mois(2)), CInt(tablo_mois(1)),
CInt(tablo_mois(0)))
result_heure = TimeSerial(CInt(tablo_heure(0)), CInt(tablo_heure(1)),
CInt(tablo_heure(2)))
If UBound(tablo_mois) = 3 Then
heure = 0: minute = 0: x = 0
Else
If InStr(1, UCase(tablo_mois(4)), "GMT") > 0 Then
heure = 0: minute = 0: x = 0
Else
heure = CInt(Mid(tablo_mois(4), 2, 2)): minute = CInt(Mid(tablo_mois(4),
4,

2))
Select Case Left(tablo_mois(4), 1)
Case "+": x = -1
Case "-": x = 1
Case Else
End Select
End If
End If
'Stop
forma = Application.Substitute(forma, "a", "y")
forma = Application.Substitute(forma, "j", "d")
decode_date = Format(result_dat + result_heure + x * (heure / 24 + minute
/

24 / 60), forma)
Exit Function
fin:
decode_date = entree_vraie
On Error GoTo 0
End Function



"" a écrit dans le message de news:

Bonjour,

Petit problème de dates.
Je baigne dans les flux RSS. En UTF-8, les dates sont affichées sous la
forme : Mon, 18 Feb 2008 19:16:50 +0100 (dans le meilleur des cas).
Y a-t-il un moyen simple en VBA pour convertir une date de ce type en
date


Excel ?
J'ai bien bricolé un truc en retirant la partie gauche (jour) et la
partie


droite (le décalage horaire) et en remplaçant "Feb" par "fév"...
(et en prévoyant le cas où la date est en "02-18-2008")
Ca marche, mais ça n'est vraiment pas propre... (et puis si j'ai une
heure


de Californie...)

Si vous connaissez une fonction ad hoc, je suis preneur !
d'avance merci


http://jacxl.free.fr