IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Access Discussion :

convertir la date grégorienne en date hijri [Toutes versions]


Sujet :

Access

  1. #1
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut convertir la date grégorienne en date hijri
    Salut.
    Comment pourrais-je créer un champ date/heure qui pour contenir rien que la date hijri (calendrier musulan)?
    Aidez moi membres du forum.
    Très cordialement.

  2. #2
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Bonjour,

    Voici un module VBA qui fait cette conversion, il s'agit de la fonction chrToIsl :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    Option Compare Database
    Option Explicit
     
    Public Function RoundUp(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundUp = -Int(-vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Public Function RoundDown(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundDown = Int(vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Function intPart(floatNum As Double) As Long
     
       If (floatNum < -0.0000001) Then
          intPart = RoundUp(floatNum - 0.0000001)
       Else
          intPart = RoundDown(floatNum + 0.0000001)
       End If
     
    End Function
     
    Function weekDay(wdn) As String
                        If (wdn = 0) Then
                            weekDay = "Monday"
     
                        ElseIf (wdn = 1) Then
                            weekDay = "Tuesday"
     
                        ElseIf (wdn = 2) Then
                            weekDay = "Wednesday"
     
                        ElseIf (wdn = 3) Then
                            weekDay = "Thursday"
     
                        ElseIf (wdn = 4) Then
                            weekDay = "Friday"
     
                        ElseIf (wdn = 5) Then
                            weekDay = "Saturday"
     
                        ElseIf (wdn = 6) Then
                            weekDay = "Sunday"
                        Else
                           weekDay = ""
                        End If
    End Function
     
     
    Function chrToIsl(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
        d = Day(dt)
        m = Month(dt)
        y = Year(dt)
     
            If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
               jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12) - _
        intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075
     
            Else
     
               jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
     
            End If
     
        l = jd - 1948440 + 10632
        n = intPart((l - 1) / 10631)
        l = l - 10631 * n + 354
        j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
        l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
        m = intPart((24 * l) / 709)
        d = l - intPart((709 * m) / 24)
        y = 30 * n + j - 30
     
        chrToIsl = DateSerial(y, m, d)
     
    End Function
     
    Function islToChr(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, i As Long, j As Long, k As Long, jd As Long, l As Long, n As Long
     
        d = (Day(dt))
        m = (Month(dt))
        y = (Year(dt))
        jd = intPart((11 * y + 3) / 30) + 354 * y + 30 * m - intPart((m - 1) / 2) + d + 1948440 - 385
     
            If (jd > 2299160) Then
     
                l = jd + 68569
                n = intPart((4 * l) / 146097)
                l = l - intPart((146097 * n + 3) / 4)
                i = intPart((4000 * (l + 1)) / 1461001)
                l = l - intPart((1461 * i) / 4) + 31
                j = intPart((80 * l) / 2447)
                d = l - intPart((2447 * j) / 80)
                l = intPart(j / 11)
                m = j + 2 - 12 * l
                y = 100 * (n - 49) + i + l
     
            Else
     
                j = jd + 1402
                k = intPart((j - 1) / 1461)
                l = j - 1461 * k
                n = intPart((l - 1) / 365) - intPart(l / 1461)
                i = l - 365 * n + 30
                j = intPart((80 * i) / 2447)
                d = i - intPart((2447 * j) / 80)
                i = intPart(j / 11)
                m = j + 2 - 12 * i
                y = 4 * k + n + i - 4716
     
            End If
     
      islToChr = DateSerial(y, m, d)
     
    End Function

  3. #3
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut Remerciement
    Citation Envoyé par User Voir le message
    Bonjour,

    Voici un module VBA qui fait cette conversion, il s'agit de la fonction chrToIsl :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    Option Compare Database
    Option Explicit
     
    Public Function RoundUp(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundUp = -Int(-vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Public Function RoundDown(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundDown = Int(vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Function intPart(floatNum As Double) As Long
     
       If (floatNum < -0.0000001) Then
          intPart = RoundUp(floatNum - 0.0000001)
       Else
          intPart = RoundDown(floatNum + 0.0000001)
       End If
     
    End Function
     
    Function weekDay(wdn) As String
                        If (wdn = 0) Then
                            weekDay = "Monday"
     
                        ElseIf (wdn = 1) Then
                            weekDay = "Tuesday"
     
                        ElseIf (wdn = 2) Then
                            weekDay = "Wednesday"
     
                        ElseIf (wdn = 3) Then
                            weekDay = "Thursday"
     
                        ElseIf (wdn = 4) Then
                            weekDay = "Friday"
     
                        ElseIf (wdn = 5) Then
                            weekDay = "Saturday"
     
                        ElseIf (wdn = 6) Then
                            weekDay = "Sunday"
                        Else
                           weekDay = ""
                        End If
    End Function
     
     
    Function chrToIsl(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
        d = Day(dt)
        m = Month(dt)
        y = Year(dt)
     
            If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
               jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12) - _
        intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075
     
            Else
     
               jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
     
            End If
     
        l = jd - 1948440 + 10632
        n = intPart((l - 1) / 10631)
        l = l - 10631 * n + 354
        j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
        l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
        m = intPart((24 * l) / 709)
        d = l - intPart((709 * m) / 24)
        y = 30 * n + j - 30
     
        chrToIsl = DateSerial(y, m, d)
     
    End Function
     
    Function islToChr(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, i As Long, j As Long, k As Long, jd As Long, l As Long, n As Long
     
        d = (Day(dt))
        m = (Month(dt))
        y = (Year(dt))
        jd = intPart((11 * y + 3) / 30) + 354 * y + 30 * m - intPart((m - 1) / 2) + d + 1948440 - 385
     
            If (jd > 2299160) Then
     
                l = jd + 68569
                n = intPart((4 * l) / 146097)
                l = l - intPart((146097 * n + 3) / 4)
                i = intPart((4000 * (l + 1)) / 1461001)
                l = l - intPart((1461 * i) / 4) + 31
                j = intPart((80 * l) / 2447)
                d = l - intPart((2447 * j) / 80)
                l = intPart(j / 11)
                m = j + 2 - 12 * l
                y = 100 * (n - 49) + i + l
     
            Else
     
                j = jd + 1402
                k = intPart((j - 1) / 1461)
                l = j - 1461 * k
                n = intPart((l - 1) / 365) - intPart(l / 1461)
                i = l - 365 * n + 30
                j = intPart((80 * i) / 2447)
                d = i - intPart((2447 * j) / 80)
                i = intPart(j / 11)
                m = j + 2 - 12 * i
                y = 4 * k + n + i - 4716
     
            End If
     
      islToChr = DateSerial(y, m, d)
     
    End Function
    Je vous remercie de m'avoir envoyé une suite à mon courrier.
    Très cordialement.

  4. #4
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut convertir la date grégorien en date hijri
    J'ai reçu le code suivant:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    Option Compare Database
    Option Explicit
     
    Public Function RoundUp(vValeur As Variant, Optional byNbDec As Byte) As Variant
    RoundUp = -Int(-vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Public Function RoundDown(vValeur As Variant, Optional byNbDec As Byte) As Variant
    RoundDown = Int(vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
    Function intPart(floatNum As Double) As Long
    If (floatNum < -0.0000001) Then
    intPart = RoundUp(floatNum - 0.0000001)
    Else
    intPart = RoundDown(floatNum + 0.0000001)
    End If
    End Function
     
    Function weekDay(wdn) As String
    If (wdn = 0) Then
    weekDay = "Monday"
     
    ElseIf (wdn = 1) Then weekDay = "Tuesday"
     
    ElseIf (wdn = 2) Then weekDay = "Wednesday"
     
    ElseIf (wdn = 3) Then weekDay = "Thursday"
     
    ElseIf (wdn = 4) Then weekDay = "Friday"
     
    ElseIf (wdn = 5) Then weekDay = "Saturday"
     
    ElseIf (wdn = 6) Then weekDay = "Sunday"
     
    Else
    weekDay = ""
    End If
     
    End Function
     
     
    Function chrToIsl(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
    d = Day(dt)
    m = Month(dt)
    y = Year(dt)
     
    If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
    jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075)
     
    Else
     
    jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
    End If
    l = jd - 1948440 + 10632
    n = intPart((l - 1) / 10631)
    l = l - 10631 * n + 354
    j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
    l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
    m = intPart((24 * l) / 709)
    d = l - intPart((709 * m) / 24)
    y = 30 * n + j - 30
     
    chrToIsl = DateSerial(y, m, d)
    End Function
     
    Function islToChr(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, i As Long, j As Long, k As Long, jd As Long, l As Long, n As Long
     
    d = (Day(dt))
    m = (Month(dt))
    y = (Year(dt))
    jd = intPart((11 * y + 3) / 30) + 354 * y + 30 * m - intPart((m - 1) / 2) + d + 1948440 - 385
    If (jd > 2299160) Then
    l = jd + 68569
    n = intPart((4 * l) / 146097)
    l = l - intPart((146097 * n + 3) / 4)
    i = intPart((4000 * (l + 1)) / 1461001)
    l = l - intPart((1461 * i) / 4) + 31
    j = intPart((80 * l) / 2447)
    d = l - intPart((2447 * j) / 80)
    l = intPart(j / 11)
     
    m = j + 2 - 12 * l
    y = 100 * (n - 49) + i + l
     
    Else
     
    j = jd + 1402
    k = intPart((j - 1) / 1461)
    l = j - 1461 * k
    n = intPart((l - 1) / 365) - intPart(l / 1461)
    i = l - 365 * n + 30
    j = intPart((80 * i) / 2447)
    d = i - intPart((2447 * j) / 80)
    i = intPart(j / 11)
    m = j + 2 - 12 * i
    y = 4 * k + n + i - 4716
    End If
    islToChr = DateSerial(y, m, d)
    End Function
    Alors j'aimerais savoir comment l'exécute t-on dans un formulaire ?
    Merci.

  5. #5
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Bonsoir,

    Dans un formulaire, vous pouvez mettre à jour la propriété source contrôle d'une zone de texte comme ceci :

    Dans une requête vous pouvez aussi créer un champ calculé comme celà:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DateIsl: chrToIsl([ChampDate])
    et appeler ce champ dans vôtre formulaire...

    Cdlt,

  6. #6
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut convertir la date grégorien en date hijri, correction
    NB: Je vous signale que le code marche parfaitement.
    Mais je dois apporter une correction au niveau de la conversion, car dans l’année hijirienne, nous sommes le 16/5/1437
    je vous envoie un pièce jointe pour vérification.
    Merci encore infiniment de m'aider à corriger mes erreurs.
    Fichiers attachés Fichiers attachés

  7. #7
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Bonjour,

    Il faudrait corriger la fonction comme ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    Function chrToIsl(dt As Date) As String
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
        d = Day(dt)
        m = Month(dt)
        y = Year(dt)
     
            If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
               jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12) - _
        intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075
     
            Else
     
               jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
     
            End If
     
        l = jd - 1948440 + 10632
        n = intPart((l - 1) / 10631)
        l = l - 10631 * n + 354
        j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
        l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
        m = intPart((24 * l) / 709)
        d = l - intPart((709 * m) / 24)
        y = 30 * n + j - 30
     
        chrToIsl = d & "/" & m & "/" & y ' DateSerial(y, m, d)
     
    End Function
    à+

  8. #8
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut Convertir la date grégorien en date hijri, Remerciement
    Merci infiniment.
    Formidable, le code de Conversion de la date grégorien en date hijri marche bien.
    Je vous remercie infiniment, et vous fais savoir que le code marche comme souhaité.
    Est-il possible de formater cette conversion en date général où le nom du jour/mois/année est affiché?
    Exemple:jeudi 17 joumadal oula 1437.

  9. #9
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Bonjour,

    J'ai modifié le module :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    Option Compare Database
    Option Explicit
     
    Public Function RoundUp(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundUp = -Int(-vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Public Function RoundDown(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundDown = Int(vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Function intPart(floatNum As Double) As Long
     
       If (floatNum < -0.0000001) Then
          intPart = RoundUp(floatNum - 0.0000001)
       Else
          intPart = RoundDown(floatNum + 0.0000001)
       End If
     
    End Function
     
    Function weekDay(wdn) As String
                        If (wdn = 0) Then
                            weekDay = "Lundi"
     
                        ElseIf (wdn = 1) Then
                            weekDay = "Mardi"
     
                        ElseIf (wdn = 2) Then
                            weekDay = "Mercredi"
     
                        ElseIf (wdn = 3) Then
                            weekDay = "Jeudi"
     
                        ElseIf (wdn = 4) Then
                            weekDay = "Vendredi"
     
                        ElseIf (wdn = 5) Then
                            weekDay = "Samedi"
     
                        ElseIf (wdn = 6) Then
                            weekDay = "Dimanche"
                        Else
                           weekDay = ""
                        End If
    End Function
     
     
    Public Function moisToIsl(m As Long) As String
     
    Select Case m
     
    Case 1
    moisToIsl = "Mouharram"
     
    Case 2
    moisToIsl = "Safar"
     
    Case 3
    moisToIsl = "Rabi' Awwal"
     
    Case 4
    moisToIsl = "Rabi' Thani"
     
    Case 5
    moisToIsl = "Joumada Awwal"
     
    Case 6
    moisToIsl = "Joumada Thani"
     
    Case 7
    moisToIsl = "Rajab"
     
    Case 8
    moisToIsl = "Cha'ban"
     
    Case 9
    moisToIsl = "Ramadan"
     
    Case 10
    moisToIsl = "Chawwal"
     
    Case 11
    moisToIsl = "Dhoul Qa'da"
     
    Case 12
    moisToIsl = "Dhoul Hijja"
     
    End Select
     
    End Function
     
     
    Function chrToIsl(dt As Date) As String
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
        d = Day(dt)
        m = Month(dt)
        y = Year(dt)
     
            If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
               jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12) - _
        intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075
     
            Else
     
               jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
     
            End If
     
        l = jd - 1948440 + 10632
        n = intPart((l - 1) / 10631)
        l = l - 10631 * n + 354
        j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
        l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
        m = intPart((24 * l) / 709)
        d = l - intPart((709 * m) / 24)
        y = 30 * n + j - 30
     
        chrToIsl = weekDay(jd Mod 7) & " " & d & " " & moisToIsl(m) & " " & y '
     
    End Function
     
    Function islToChr(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, i As Long, j As Long, k As Long, jd As Long, l As Long, n As Long
     
        d = (Day(dt))
        m = (Month(dt))
        y = (Year(dt))
        jd = intPart((11 * y + 3) / 30) + 354 * y + 30 * m - intPart((m - 1) / 2) + d + 1948440 - 385
     
            If (jd > 2299160) Then
     
                l = jd + 68569
                n = intPart((4 * l) / 146097)
                l = l - intPart((146097 * n + 3) / 4)
                i = intPart((4000 * (l + 1)) / 1461001)
                l = l - intPart((1461 * i) / 4) + 31
                j = intPart((80 * l) / 2447)
                d = l - intPart((2447 * j) / 80)
                l = intPart(j / 11)
                m = j + 2 - 12 * l
                y = 100 * (n - 49) + i + l
     
            Else
     
                j = jd + 1402
                k = intPart((j - 1) / 1461)
                l = j - 1461 * k
                n = intPart((l - 1) / 365) - intPart(l / 1461)
                i = l - 365 * n + 30
                j = intPart((80 * i) / 2447)
                d = i - intPart((2447 * j) / 80)
                i = intPart(j / 11)
                m = j + 2 - 12 * i
                y = 4 * k + n + i - 4716
     
            End If
     
      islToChr = DateSerial(y, m, d)
     
    End Function
    Cdlt,

  10. #10
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut Convertir la date grégorien en date hijri, Remerciement encore
    Je suis vraiment émerveillé. Fort est de reconnaître votre statut d'excellence.
    Merci merci infiniment.

  11. #11
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    De rien,

    J'ai simplement adapté le code contenu dans la source d'une page web.

    Pouvez-vous clore la discussion ?

    Merci

  12. #12
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut Convertir la date grégorien en date hijri, Remerciement
    Citation Envoyé par User Voir le message
    De rien,

    J'ai simplement adapté le code contenu dans la source d'une page web.

    Pouvez-vous clore la discussion ?

    Merci
    Merci! Je m'arrête ici tout en espérant vous retrouver bientôt.

  13. #13
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Citation Envoyé par morobaboumar Voir le message
    Merci! Je m'arrête ici tout en espérant vous retrouver bientôt.
    Dans ce cas je vous invite à clore la discussion et à en ouvrir une nouvelle si nécessaire.

    Cdlt,

  14. #14
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut Convertir la date grégorien en date hijri, en lettre arabe
    Bonjour.
    Membres du forum,
    Permettez moi de rouvrir cette discussion.

    Je reviens vous demander s'il est possible de faire la correspondance en langue arabe
    de la date hijiri selon l'exemple suivant:
    Nom : DateHejiri.png
Affichages : 563
Taille : 19,4 Ko.

    Je signale que dans l'exemple de base de données que je vous renvoie,
    j'ai créé une table de corresponce:Tbl_JoursDelaSemaine et une autre table: Tbl_MoisDeLAnnee.

    Alors expliquez moi comment dois je faire pour pouvoir afficher la date Hijiri en écriture arabe.

    Merci de me comprendre.
    Très cordialement
    Fichiers attachés Fichiers attachés

  15. #15
    Rédacteur/Modérateur

    Avatar de User
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    8 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 8 412
    Points : 19 988
    Points
    19 988
    Billets dans le blog
    66
    Par défaut
    Bonjour,

    Il faudrait ajouter au module ces 2 fonctions :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Public Function WeekDayAr(j As Long) As String ' Traduction du jour de la semaine.
       WeekDayAr = DLookup("L_JourAr", "Tbl_JoursDelaSemaine", "ID_Jour=" & (j + 1))
    End Function
     
    Public Function MoisAr(m As Long) As String ' Traduction du mois.
        MoisAr = DLookup("L_MoisAr", "Tbl_MoisDelAnnee", "ID_Mois=" & m)
    End Function
    Le module "MduConversionDateGregorienne_Hijiri_Plus" devient :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
     
    Option Compare Database
    Option Explicit
     
    Public Function RoundUp(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundUp = -Int(-vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Public Function RoundDown(vValeur As Variant, Optional byNbDec As Byte) As Variant
       RoundDown = Int(vValeur * 10 ^ byNbDec) / 10 ^ byNbDec
    End Function
     
    Function intPart(floatNum As Double) As Long
     
       If (floatNum < -0.0000001) Then
          intPart = RoundUp(floatNum - 0.0000001)
       Else
          intPart = RoundDown(floatNum + 0.0000001)
       End If
     
    End Function
     
    Function weekDay(wdn) As String
                        If (wdn = 0) Then
                            weekDay = "Lundi"
     
                        ElseIf (wdn = 1) Then
                            weekDay = "Mardi"
     
                        ElseIf (wdn = 2) Then
                            weekDay = "Mercredi"
     
                        ElseIf (wdn = 3) Then
                            weekDay = "Jeudi"
     
                        ElseIf (wdn = 4) Then
                            weekDay = "Vendredi"
     
                        ElseIf (wdn = 5) Then
                            weekDay = "Samedi"
     
                        ElseIf (wdn = 6) Then
                            weekDay = "Dimanche"
                        Else
                           weekDay = ""
                        End If
    End Function
     
     
    Public Function moisToIsl(m As Long) As String
     
    Select Case m
     
    Case 1
    moisToIsl = "Mouharram"
     
    Case 2
    moisToIsl = "Safar"
     
    Case 3
    moisToIsl = "Rabi' Awwal"
     
    Case 4
    moisToIsl = "Rabi' Thani"
     
    Case 5
    moisToIsl = "Joumada Awwal"
     
    Case 6
    moisToIsl = "Joumada Thani"
     
    Case 7
    moisToIsl = "Rajab"
     
    Case 8
    moisToIsl = "Cha'ban"
     
    Case 9
    moisToIsl = "Ramadan"
     
    Case 10
    moisToIsl = "Chawwal"
     
    Case 11
    moisToIsl = "Dhoul Qa'da"
     
    Case 12
    moisToIsl = "Dhoul Hijja"
     
    End Select
     
    End Function
     
     
    Function chrToIsl_Plus(dt As Date) As String
    Dim d As Long, m As Long, y As Long, j As Long, jd As Long, l As Long, n As Long
     
        d = Day(dt)
        m = Month(dt)
        y = Year(dt)
     
            If ((y > 1582) Or ((y = 1582) And (m > 10)) And ((y = 1582) And (m = 10) And (d > 14))) Then
     
               jd = intPart((1461 * (y + 4800 + intPart((m - 14) / 12))) / 4) + intPart((367 * (m - 2 - 12 * (intPart((m - 14) / 12)))) / 12) - _
        intPart((3 * (intPart((y + 4900 + intPart((m - 14) / 12)) / 100))) / 4) + d - 32075
     
            Else
     
               jd = 367 * y - intPart((7 * (y + 5001 + intPart((m - 9) / 7))) / 4) + intPart((275 * m) / 9) + d + 1729777
     
            End If
     
        l = jd - 1948440 + 10632
        n = intPart((l - 1) / 10631)
        l = l - 10631 * n + 354
        j = (intPart((10985 - l) / 5316)) * (intPart((50 * l) / 17719)) + (intPart(l / 5670)) * (intPart((43 * l) / 15238))
        l = l - (intPart((30 - j) / 15)) * (intPart((17719 * j) / 50)) - (intPart(j / 16)) * (intPart((15238 * j) / 43)) + 29
        m = intPart((24 * l) / 709)
        d = l - intPart((709 * m) / 24)
        y = 30 * n + j - 30
     
        chrToIsl_Plus = WeekDayAr(jd Mod 7) & " " & d & " " & MoisAr(m) & " " & y '
     
    End Function
     
    Function islToChr_Plus(dt As Date) As Date
    Dim d As Long, m As Long, y As Long, i As Long, j As Long, k As Long, jd As Long, l As Long, n As Long
     
        d = (Day(dt))
        m = (Month(dt))
        y = (Year(dt))
        jd = intPart((11 * y + 3) / 30) + 354 * y + 30 * m - intPart((m - 1) / 2) + d + 1948440 - 385
     
            If (jd > 2299160) Then
     
                l = jd + 68569
                n = intPart((4 * l) / 146097)
                l = l - intPart((146097 * n + 3) / 4)
                i = intPart((4000 * (l + 1)) / 1461001)
                l = l - intPart((1461 * i) / 4) + 31
                j = intPart((80 * l) / 2447)
                d = l - intPart((2447 * j) / 80)
                l = intPart(j / 11)
                m = j + 2 - 12 * l
                y = 100 * (n - 49) + i + l
     
            Else
     
                j = jd + 1402
                k = intPart((j - 1) / 1461)
                l = j - 1461 * k
                n = intPart((l - 1) / 365) - intPart(l / 1461)
                i = l - 365 * n + 30
                j = intPart((80 * i) / 2447)
                d = i - intPart((2447 * j) / 80)
                i = intPart(j / 11)
                m = j + 2 - 12 * i
                y = 4 * k + n + i - 4716
     
            End If
     
      islToChr_Plus = DateSerial(y, m, d)
     
    End Function
     
    Public Function WeekDayAr(j As Long) As String
       WeekDayAr = DLookup("L_JourAr", "Tbl_JoursDelaSemaine", "ID_Jour=" & (j + 1))
    End Function
     
    Public Function MoisAr(m As Long) As String
        MoisAr = DLookup("L_MoisAr", "Tbl_MoisDelAnnee", "ID_Mois=" & m)
    End Function
    Cdlt,

  16. #16
    Membre confirmé Avatar de morobaboumar
    Homme Profil pro
    Enseignant
    Inscrit en
    Septembre 2009
    Messages
    1 135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1 135
    Points : 497
    Points
    497
    Par défaut convertir la date grégorien en date hijri, recorrection
    Salut membre du forum.
    Je vous prie de m'aider à recorriger le code de conversion de date grégorienne en
    date hijiri car il affiche: Vendredi 01 joumada thani 1437. Par contre aujourd'hui nous
    sommes Vendredi 02 joumada thani 1437.
    Nom : ConversionDate.png
Affichages : 574
Taille : 85,9 Ko

    Pièces jointes: 1-Image affichant la conversion de dates
    2- Copie de ma Base de données CalendrierHijiri
    3- Image d'affichage de date hijiri sous excell
    Qestion:
    Peut-on adapter l'affichage de date Hijiri d'Excel à Access?
    Comment pourrais-je corriger le code en cas de besoin?
    Images attachées Images attachées  
    Fichiers attachés Fichiers attachés

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Convertir le format de date grégorienne à la date Hijri
    Par Boubou2020 dans le forum Développement
    Réponses: 1
    Dernier message: 21/10/2015, 11h37
  2. [XL-2007] couleur cellule date differente si date passee, ou date du jour
    Par chris09300 dans le forum Macros et VBA Excel
    Réponses: 11
    Dernier message: 29/03/2011, 08h24
  3. Convertir une date lunaire en date grégorienne
    Par Typiaf dans le forum Débuter
    Réponses: 8
    Dernier message: 15/10/2010, 15h55
  4. Convertir date julienne en date grégorienne
    Par afrodje dans le forum WebDev
    Réponses: 10
    Dernier message: 22/07/2010, 11h18
  5. []Comment convertir une date GMT en date vb ?
    Par Invité dans le forum VB 6 et antérieur
    Réponses: 10
    Dernier message: 11/08/2004, 16h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo