Kata Baru

Tentang Pikiran, Perkataan, dan Perbuatan

Menghitung Hari Libur Keagamaan (China) dengan VB Classic


Pada artikel sebelumya saya sudah menuliskan tentang “Menghitung Hari Libur Keagamaan (Kristen) dengan VB Classic”, Menghitung Hari Libur Keagamaan (Hindu) dengan VB Classic, dan Menghitung Hari Libur Keagamaan (Buddha) dengan VB Classic. Berikutnya giliran menghitung hari libur China (Imlek).

Sebetulnya perumusan perhitungan Imlek sama sekali tidak berbeda dengan penghitungan hari Waisak, yang berbeda hanya penentuan beberapa variabel konstanta saja. Kita langsung saja melihat perumusannya.

Buatlah sebuah module pada IDE VB6, namai dengan “basChina”, kemudian ketikkan kode di bawah ini:

Option Explicit

Public Imlek As Date
Public Shio As String

Private Function iMod(dblValue1, dblValue2) As Double
On Error Resume Next
    iMod = dblValue1 - dblValue2 * Int(dblValue1 / dblValue2)
End Function

Private Function RoundDown(dblValue As Double) As Double
On Error GoTo PROC_ERR
Dim myDec As Long

myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
If myDec > 0 Then
    RoundDown = CDbl(Left(CStr(dblValue), myDec))
Else
    RoundDown = dblValue
End If

PROC_EXIT:
    Exit Function
PROC_ERR:
    MsgBox Err.Description, vbInformation, "Round Down"
End Function

Private Function RoundUp(dblValue As Double) As Double
On Error GoTo PROC_ERR
Dim myDec As Long

myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
If myDec > 0 Then
    RoundUp = CDbl(Left(CStr(dblValue), myDec)) + 1
Else
    RoundUp = dblValue
End If

PROC_EXIT:
    Exit Function
PROC_ERR:
    MsgBox Err.Description, vbInformation, "Round Up"
End Function

Private Function Trunc(dblValue As Double) As Long
On Error Resume Next
    Dim strValue As String
    
    If dblValue = 0 Then
        Trunc = 0
        Exit Function
    End If
    
    Dim myDec As Integer
    Dim Pisah() As String
    
    myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
    
    If myDec <> 0 Then
        Pisah = Split(CStr(dblValue), ".")
        strValue = Pisah(0)
    Else
        strValue = dblValue
    End If
    
    Trunc = CLng(strValue)
End Function

Public Sub China(iTahun As Integer)
    Dim intIJST(1 To 2) As Integer
    Dim intTanggal(1 To 2) As Integer
    Dim intBulan(1 To 2) As Integer
    Dim intTahun(1 To 2) As Integer
    
    Dim intTa1(1 To 2) As Integer
    Dim intTa2(1 To 2) As Integer
    Dim intTa3(1 To 2) As Integer
    
    Const PI As Double = 3.141592654
    
    Dim dblKN(1 To 2) As Double
    Dim dblKB(1 To 2) As Double
    Dim dblT(1 To 2) As Double
    
    Dim dblK1(1 To 2) As Double
    Dim dblK2(1 To 2) As Double
    Dim dblK3(1 To 2) As Double
    Dim dblK4(1 To 2) As Double
    Dim dblK5(1 To 2) As Double
    Dim dblK6(1 To 2) As Double
    Dim dblK7(1 To 2) As Double
    
    Dim dblM(1 To 2) As Double
    Dim dblM1(1 To 2) As Double
    Dim dblM2(1 To 2) As Double
    Dim dblM3(1 To 2) As Double
    
    Dim dblMA(1 To 2) As Double
    Dim dblMA1(1 To 2) As Double
    Dim dblMA2(1 To 2) As Double
    Dim dblMA3(1 To 2) As Double
        
    Dim dblF(1 To 2) As Double
    Dim dblF1(1 To 2) As Double
    Dim dblF2(1 To 2) As Double
    Dim dblF3(1 To 2) As Double
    
    Dim dblKRA1(1 To 2) As Double
    Dim dblKRA2(1 To 2) As Double
    Dim dblKRA3(1 To 2) As Double
    Dim dblKRA4(1 To 2) As Double
    Dim dblKRA5(1 To 2) As Double
    Dim dblKRA6(1 To 2) As Double
    Dim dblKORA(1 To 2) As Double
    
    Dim dblKRB1(1 To 2) As Double
    Dim dblKRB2(1 To 2) As Double
    Dim dblKRB3(1 To 2) As Double
    Dim dblKRB4(1 To 2) As Double
    Dim dblKRB5(1 To 2) As Double
    Dim dblKORB(1 To 2) As Double
    Dim dblKORB1(1 To 2) As Double
    
    Dim dblKC1(1 To 2) As Double
    Dim dblKC2(1 To 2) As Double
    Dim dblKC3(1 To 2) As Double
    Dim dblKORC(1 To 2) As Double
    Dim dblKORC1(1 To 2) As Double
    
    Dim dblKoreksi(1 To 2) As Double
    
    Dim dblJdA1(1 To 2) As Double
    Dim dblJdA2(1 To 2) As Double
    Dim dblJdA3(1 To 2) As Double
    
    Dim dblJdB1(1 To 2) As Double
    Dim dblJdB2(1 To 2) As Double
    Dim dblJdB3(1 To 2) As Double
    
    Dim dblJdC1(1 To 2) As Double
    Dim dblJdC2(1 To 2) As Double
    Dim dblJdC3(1 To 2) As Double
    
    Dim dblJD(1 To 2) As Double
    
    Dim dblZJd(1 To 2) As Double
    Dim dblEFJd(1 To 2) As Double
    Dim dblAPJd(1 To 2) As Double
    Dim dblAJd(1 To 2) As Double
    Dim dblBJd(1 To 2) As Double
    Dim dblCJd(1 To 2) As Double
    Dim dblDJd(1 To 2) As Double
    Dim dblEJd(1 To 2) As Double
    
    Dim dblHasilJam(1 To 2) As Double
    Dim dblHasilBulan(1 To 2) As Integer
    Dim dblHasilTahun(1 To 2) As Integer
    Dim dblHasilHari(1 To 2) As Integer
    Dim dblHasilPasaran(1 To 2) As Integer
    
    Dim dblTgl1(1 To 2) As Double
    Dim dblTgl2(1 To 2) As Double
    Dim dblTgl3(1 To 2) As Double
    Dim dblTgl4(1 To 2) As Double
    Dim dblTgl5(1 To 2) As Double
    Dim dblTglM(1 To 2) As Double
    
    Dim dblKT(1 To 2) As Double
    Dim dblET1(1 To 2) As Double
    Dim dblET2(1 To 2) As Double
    Dim dblKET(1 To 2) As Double
    
    Dim dblJDH(1 To 2) As Double
    
    Dim datFull(1 To 2) As Date
    Dim datHasil(1 To 2) As Date
        
    intIJST(1) = 1
    intTanggal(1) = 22
    intBulan(1) = 12
    intTahun(1) = iTahun - 1
    
    datFull(1) = DateSerial(intTahun(1), intBulan(1), intTanggal(1))
    
    intTa1(1) = IIf((intTahun(1) Mod 4) = 0, 1, 0)
    intTa2(1) = IIf((intTahun(1) Mod 100) = 0, 1, 0)
    intTa3(1) = intTa1(1) + intTa2(1)
    
    dblKB(1) = IIf(intTa3(1) > 0, 1, 2)
    
    dblK1(1) = Trunc((275 * intBulan(1)) / 9)
    dblK2(1) = Trunc((intBulan(1) + 9) / 12) * dblKB(1)
    dblK3(1) = (dblK1(1) - dblK2(1) + intTanggal(1) - 30)
    dblK4(1) = (dblK3(1) / 365.25) + (intTahun(1) - 1900)
    dblK5(1) = (dblK4(1) * 12.3685)
    dblK6(1) = (dblK5(1) - Trunc(dblK5(1)))
    dblK7(1) = IIf(dblK6(1) > 0.5, Trunc(dblK5(1) + 1), Trunc(dblK5(1) + 0))
    
    dblKN(1) = IIf(intIJST(1) = 1, (dblK7(1) - 0), (dblK7(1) - 0.5))
    dblT(1) = (dblKN(1) / 1236.85)
    
    dblM1(1) = 29.10535608 * dblKN(1)
    dblM2(1) = -0.000033 * dblT(1) * dblT(1)
    dblM3(1) = -0.00000347 * dblT(1) * dblT(1) * dblT(1)
    dblM(1) = iMod(359.2242 + dblM1(1) + dblM2(1) + dblM3(1), 360)
    
    dblMA1(1) = 385.81691806 * dblKN(1)
    dblMA2(1) = 0.0107306 * dblT(1) * dblT(1)
    dblMA3(1) = 0.00001236 * dblT(1) * dblT(1) * dblT(1)
    dblMA(1) = iMod(306.0253 + dblMA1(1) + dblMA2(1) + dblMA3(1), 360)
    
    dblF1(1) = 390.67050646 * dblKN(1)
    dblF2(1) = -0.0016528 * dblT(1) * dblT(1)
    dblF3(1) = -0.00000239 * dblT(1) * dblT(1) * dblT(1)
    dblF(1) = iMod(21.2964 + dblF1(1) + dblF2(1) + dblF3(1), 360)
    
    dblKRA1(1) = 0.1734 - (0.000393 * dblT(1))
    dblKRA2(1) = (dblKRA1(1) * Sin(dblM(1) * PI / 180))
    dblKRA3(1) = -0.4068 * Sin(dblMA(1) * PI / 180)
    dblKRA4(1) = 0.0021 * Sin(2 * dblM(1) * PI / 180)
    dblKRA5(1) = 0.0161 * Sin(2 * dblMA(1) * PI / 180)
    dblKRA6(1) = -0.0004 * Sin(3 * dblMA(1) * PI / 180)
    dblKORA(1) = (dblKRA2(1) + dblKRA3(1) + dblKRA4(1) + dblKRA5(1) + dblKRA6(1))
    
    dblKRB1(1) = -0.0051 * Sin((dblM(1) + dblMA(1)) * PI / 180)
    dblKRB2(1) = -0.0074 * Sin((dblM(1) - dblMA(1)) * PI / 180)
    dblKRB3(1) = 0.0004 * Sin((2 * dblF(1) + dblM(1)) * PI / 180)
    dblKRB4(1) = -0.0004 * Sin((2 * dblF(1) - dblM(1)) * PI / 180)
    dblKRB5(1) = 0.0104 * Sin(2 * dblF(1) * PI / 180)
    dblKORB(1) = (dblKRB1(1) + dblKRB2(1) + dblKRB3(1) + dblKRB4(1) + dblKRB5(1))
    dblKORB1(1) = -0.0051 * Sin((dblM(1) + dblMA(1)) * PI / 180) + _
                  -0.0074 * Sin((dblM(1) - dblMA(1)) * PI / 180) + _
                  0.0004 * Sin((2 * dblF(1) + dblM(1)) * PI / 180) + _
                  -0.0004 * Sin((2 * dblF(1) - dblM(1)) * PI / 180) + _
                  0.0104 * Sin(2 * dblF(1) * PI / 180)
    
    dblKC1(1) = -0.0006 * Sin((2 * dblF(1) + dblMA(1)) * PI / 180)
    dblKC2(1) = 0.001 * Sin((2 * dblF(1) - dblMA(1)) * PI / 180)
    dblKC3(1) = 0.0005 * Sin((dblM(1) + 2 * dblMA(1)) * PI / 180)
    dblKORC(1) = (dblKC1(1) + dblKC2(1) + dblKC3(1))
    dblKORC1(1) = -0.0006 * Sin((2 * dblF(1) + dblMA(1)) * PI / 180) + _
                  0.001 * Sin((2 * dblF(1) - dblMA(1)) * PI / 180) + _
                  0.0005 * Sin((dblM(1) + 2 * dblMA(1)) * PI / 180)
    
    dblKoreksi(1) = (dblKORA(1) + dblKORB(1) + dblKORC(1))
    
    dblJdA1(1) = 29.53058868 * dblKN(1)
    dblJdA2(1) = 0.0001178 * dblT(1) * dblT(1) * dblT(1)
    dblJdA3(1) = -0.000000155 * dblT(1) * dblT(1) * dblT(1)
    
    dblJdB1(1) = 132.87 * dblT(1)
    dblJdB2(1) = 0.009173 * dblT(1) * dblT(1)
    dblJdB3(1) = 166.56 + dblJdB1(1) - dblJdB2(1)
    
    dblJdC1(1) = 0.00033 * Sin(dblJdB3(1) * PI / 180)
    dblJdC2(1) = (dblJdA1(1) + dblJdA2(1) + dblJdA3(1) + dblJdC1(1))
    dblJdC3(1) = 2415020.75933 + dblJdC2(1)
    dblJD(1) = (dblJdC3(1) + 0.5 + dblKoreksi(1))
    
    dblZJd(1) = Trunc(dblJD(1))
    dblEFJd(1) = (dblJD(1) - dblZJd(1))
    dblAPJd(1) = Trunc((dblZJd(1) - 1867216.25) / 36524.25)
    dblAJd(1) = IIf(dblZJd(1) < 2299161, dblZJd(1), _
    dblZJd(1) + 1 + dblAPJd(1) - Trunc(dblAPJd(1) / 4))
    
    dblBJd(1) = (dblAJd(1) + 1524)
    dblCJd(1) = Trunc((dblBJd(1) - 122.1) / 365.25)
    dblDJd(1) = Trunc(365.25 * dblCJd(1))
    dblEJd(1) = Trunc((dblBJd(1) - dblDJd(1)) / 30.6001)
    
    dblTgl1(1) = (dblBJd(1) - dblDJd(1) - Trunc(30.6001 * dblEJd(1)) + dblEFJd(1))
    dblTgl2(1) = Trunc(dblTgl1(1))
    dblTgl3(1) = (dblTgl1(1) - dblTgl2(1))
    dblTgl4(1) = (dblTgl3(1) * 24)
    dblTgl5(1) = (dblTgl4(1) + 7)
    dblTglM(1) = IIf(dblTgl5(1) <= 24, dblTgl2(1), dblTgl2(1) + 1)
    
    dblKT(1) = (dblK4(1) - 100) / 100
    dblET1(1) = 123.5 * dblKT(1)
    dblET2(1) = 32.5 * dblKT(1) * dblKT(1)
    dblKET(1) = (102.3 + dblET1(1) + dblET2(1)) / 3600
    
    dblJDH(1) = IIf(dblTgl5(1) <= 24, (dblZJd(1) + 2), dblZJd(1) + 3)
    
    dblHasilBulan(1) = IIf(dblEJd(1) < 13.5, dblEJd(1) - 1, dblEJd(1) - 13)
    dblHasilTahun(1) = IIf(dblHasilBulan(1) < 2.5, _
    Trunc(dblCJd(1) - 4715), Trunc(dblCJd(1) - 4716))
    
    dblHasilHari(1) = (dblJDH(1) - Trunc(dblJDH(1) / 7) * 7)
    dblHasilPasaran(1) = (dblJDH(1) - Trunc(dblJDH(1) / 5) * 5)
    dblHasilJam(1) = IIf(dblTgl5(1) > 24, (dblTgl5(1) - 24), dblTgl5(1))
    
    
    'Tabel 2
    datHasil(1) = DateSerial(dblHasilTahun(1), dblHasilBulan(1), dblTglM(1))
    datFull(2) = IIf(datHasil(1) > datFull(1), datHasil(1) + 29, datHasil(1) + (29 * 2))
    '
    intIJST(2) = 1
    intTanggal(2) = Day(datFull(2))
    intBulan(2) = Month(datFull(2))
    intTahun(2) = Year(datFull(2))
    
    intTa1(2) = IIf((intTahun(2) Mod 4) = 0, 1, 0)
    intTa2(2) = IIf((intTahun(2) Mod 100) = 0, 1, 0)
    intTa3(2) = intTa1(2) + intTa2(2)
    
    dblKB(2) = IIf(intTa3(2) > 0, 1, 2)
    
    '===========================================================================
    
    dblK1(2) = Trunc((275 * intBulan(2)) / 9)
    dblK2(2) = Trunc((intBulan(2) + 9) / 12) * dblKB(2)
    dblK3(2) = (dblK1(2) - dblK2(2) + intTanggal(2) - 30)
    dblK4(2) = (dblK3(2) / 365.25) + (intTahun(2) - 1900)
    dblK5(2) = (dblK4(2) * 12.3685)
    dblK6(2) = (dblK5(2) - Trunc(dblK5(2)))
    dblK7(2) = IIf(dblK6(2) > 0.5, Trunc(dblK5(2) + 1), Trunc(dblK5(2) + 0))
    
    dblKN(2) = IIf(intIJST(2) = 1, (dblK7(2) - 0), (dblK7(2) - 0.5))
    dblT(2) = (dblKN(2) / 1236.85)
    
    dblM1(2) = 29.10535608 * dblKN(2)
    dblM2(2) = -0.000033 * dblT(2) * dblT(2)
    dblM3(2) = -0.00000347 * dblT(2) * dblT(2) * dblT(2)
    dblM(2) = iMod(359.2242 + dblM1(2) + dblM2(2) + dblM3(2), 360)
    
    dblMA1(2) = 385.81691806 * dblKN(2)
    dblMA2(2) = 0.0107306 * dblT(2) * dblT(2)
    dblMA3(2) = 0.00001236 * dblT(2) * dblT(2) * dblT(2)
    dblMA(2) = iMod(306.0253 + dblMA1(2) + dblMA2(2) + dblMA3(2), 360)
    
    dblF1(2) = 390.67050646 * dblKN(2)
    dblF2(2) = -0.0016528 * dblT(2) * dblT(2)
    dblF3(2) = -0.00000239 * dblT(2) * dblT(2) * dblT(2)
    dblF(2) = iMod(21.2964 + dblF1(2) + dblF2(2) + dblF3(2), 360)
    
    dblKRA1(2) = 0.1734 - (0.000393 * dblT(2))
    dblKRA2(2) = (dblKRA1(2) * Sin(dblM(2) * PI / 180))
    dblKRA3(2) = -0.4068 * Sin(dblMA(2) * PI / 180)
    dblKRA4(2) = 0.0021 * Sin(2 * dblM(2) * PI / 180)
    dblKRA5(2) = 0.0161 * Sin(2 * dblMA(2) * PI / 180)
    dblKRA6(2) = -0.0004 * Sin(3 * dblMA(2) * PI / 180)
    dblKORA(2) = (dblKRA2(2) + dblKRA3(2) + dblKRA4(2) + dblKRA5(2) + dblKRA6(2))
    
    dblKRB1(2) = -0.0051 * Sin((dblM(2) + dblMA(2)) * PI / 180)
    dblKRB2(2) = -0.0074 * Sin((dblM(2) - dblMA(2)) * PI / 180)
    dblKRB3(2) = 0.0004 * Sin((2 * dblF(2) + dblM(2)) * PI / 180)
    dblKRB4(2) = -0.0004 * Sin((2 * dblF(2) - dblM(2)) * PI / 180)
    dblKRB5(2) = 0.0104 * Sin(2 * dblF(2) * PI / 180)
    dblKORB(2) = (dblKRB1(2) + dblKRB2(2) + dblKRB3(2) + dblKRB4(2) + dblKRB5(2))
    dblKORB1(2) = -0.0051 * Sin((dblM(2) + dblMA(2)) * PI / 180) + _
                  -0.0074 * Sin((dblM(2) - dblMA(2)) * PI / 180) + _
                  0.0004 * Sin((2 * dblF(2) + dblM(2)) * PI / 180) + _
                  -0.0004 * Sin((2 * dblF(2) - dblM(2)) * PI / 180) + _
                  0.0104 * Sin(2 * dblF(2) * PI / 180)
    
    dblKC1(2) = -0.0006 * Sin((2 * dblF(2) + dblMA(2)) * PI / 180)
    dblKC2(2) = 0.001 * Sin((2 * dblF(2) - dblMA(2)) * PI / 180)
    dblKC3(2) = 0.0005 * Sin((dblM(2) + 2 * dblMA(2)) * PI / 180)
    dblKORC(2) = (dblKC1(2) + dblKC2(2) + dblKC3(2))
    dblKORC1(2) = -0.0006 * Sin((2 * dblF(2) + dblMA(2)) * PI / 180) + _
                  0.001 * Sin((2 * dblF(2) - dblMA(2)) * PI / 180) + _
                  0.0005 * Sin((dblM(2) + 2 * dblMA(2)) * PI / 180)
    
    dblKoreksi(2) = (dblKORA(2) + dblKORB(2) + dblKORC(2))
    
    dblJdA1(2) = 29.53058868 * dblKN(2)
    dblJdA2(2) = 0.0001178 * dblT(2) * dblT(2) * dblT(2)
    dblJdA3(2) = -0.000000155 * dblT(2) * dblT(2) * dblT(2)
    
    dblJdB1(2) = 132.87 * dblT(2)
    dblJdB2(2) = 0.009173 * dblT(2) * dblT(2)
    dblJdB3(2) = 166.56 + dblJdB1(2) - dblJdB2(2)
    
    dblJdC1(2) = 0.00033 * Sin(dblJdB3(2) * PI / 180)
    dblJdC2(2) = (dblJdA1(2) + dblJdA2(2) + dblJdA3(2) + dblJdC1(2))
    dblJdC3(2) = 2415020.75933 + dblJdC2(2)
    dblJD(2) = (dblJdC3(2) + 0.5 + dblKoreksi(2))
    
    dblZJd(2) = Trunc(dblJD(2))
    dblEFJd(2) = (dblJD(2) - dblZJd(2))
    dblAPJd(2) = Trunc((dblZJd(2) - 1867216.25) / 36524.25)
    dblAJd(2) = IIf(dblZJd(2) < 2299161, dblZJd(2), _
    dblZJd(2) + 1 + dblAPJd(2) - Trunc(dblAPJd(2) / 4))
    
    dblBJd(2) = (dblAJd(2) + 1524)
    dblCJd(2) = Trunc((dblBJd(2) - 122.1) / 365.25)
    dblDJd(2) = Trunc(365.25 * dblCJd(2))
    dblEJd(2) = Trunc((dblBJd(2) - dblDJd(2)) / 30.6001)
    
    dblTgl1(2) = (dblBJd(2) - dblDJd(2) - Trunc(30.6001 * dblEJd(2)) + dblEFJd(2))
    dblTgl2(2) = Trunc(dblTgl1(2))
    dblTgl3(2) = (dblTgl1(2) - dblTgl2(2))
    dblTgl4(2) = (dblTgl3(2) * 24)
    dblTgl5(2) = (dblTgl4(2) + 7)
    dblTglM(2) = IIf(dblTgl5(2) <= 24, dblTgl2(2), dblTgl2(2) + 1)
    
    dblKT(2) = (dblK4(2) - 100) / 100
    dblET1(2) = 123.5 * dblKT(2)
    dblET2(2) = 32.5 * dblKT(2) * dblKT(2)
    dblKET(2) = (102.3 + dblET1(2) + dblET2(2)) / 3600
    
    dblJDH(2) = IIf(dblTgl5(2) <= 24, (dblZJd(2) + 2), dblZJd(2) + 3)
    
    dblHasilBulan(2) = IIf(dblEJd(2) < 13.5, dblEJd(2) - 1, dblEJd(2) - 13)
    dblHasilTahun(2) = IIf(dblHasilBulan(2) < 2.5, _
    Trunc(dblCJd(2) - 4715), Trunc(dblCJd(2) - 4716))
    
    dblHasilHari(2) = (dblJDH(2) - Trunc(dblJDH(2) / 7) * 7)
    dblHasilPasaran(2) = (dblJDH(2) - Trunc(dblJDH(2) / 5) * 5)
    dblHasilJam(2) = IIf(dblTgl5(2) > 24, (dblTgl5(2) - 24), dblTgl5(2))
    
    datHasil(2) = DateSerial(dblHasilTahun(2), dblHasilBulan(2), dblTglM(2))
    
    Imlek = datHasil(2)
    
    Dim strShio(0 To 11) As String
    Dim intShio As Integer
    
    strShio(0) = "Ayam"
    strShio(1) = "Anjing"
    strShio(2) = "Babi"
    strShio(3) = "Tikus"
    strShio(4) = "Kerbau"
    strShio(5) = "Harimau"
    strShio(6) = "Kelinci"
    strShio(7) = "Naga"
    strShio(8) = "Ular"
    strShio(9) = "Kuda"
    strShio(10) = "Kambing"
    strShio(11) = "Monyet"
    
    intShio = (iTahun + 551) Mod 12
    Shio = strShio(intShio)
End Sub

16 responses to “Menghitung Hari Libur Keagamaan (China) dengan VB Classic

  1. andika 24 April 2012 06:44 pukul 06:44

    om, klo yang imlek qo hasilnya nggak sesuai ya?
    apa ada salah code?
    ini kaya ada yang kurang deh om

    ‘ dblTglM(1) = IIf(dblTgl5(1) 24, (dblTgl5(1) – 24), dblTgl5(1))’

  2. shempax113 25 April 2012 19:44 pukul 19:44

    Wow, cepet sekali, om tapi tanggalnya masih belum sama nih dengan screenshot om yang sudah digabung semua modulenya. apa ada salah algoritma ya om, klo saya coba input iTahun dengan 2012 maka untuk imlek tampilnya tanggal : 14/01/14

    mohon pencerahannya om

  3. shempax113 26 April 2012 09:33 pukul 09:33

    saya coba masih 14/01/2014 om, apa ada penggunaan fungsi dari module yang lain om? soalnya yang saya bikin cuma basChina dan form aja. oh iya om, untuk regional setting dan lain-lain ada yang perlu disetting ngga?

    Terima kasih om

    • Novian Agung 26 April 2012 09:36 pukul 09:36

      Saya juga coba hanya bikin Form dan Module saja, tanpa ada tambahan apa-apa😀
      Coba salin ulang kode di artikel di atas ke Module nya…

      • shempax113 26 April 2012 09:49 pukul 09:49

        udah om, modulenya dengan nama basChina, form nya form1, udah langsung dicemplungin di form pun trus nampilinnya di label, hasilnya tetep 14/01/2014 om. windows pengaruh ngga ya om? saya pake win 7.

        • Novian Agung 26 April 2012 09:57 pukul 09:57

          Kok 2014 om?😀
          Kalau mengenai OS, sepertinya tidak ada masalah, kecuali kalau si om menulisnya di bahasa VB.Net, ada kemungkinan😀

          Ini langkah yang saya lakukan om:
          1. Buka IDE VB6, tambahkan Module
          2. Kembali ke artikel ini, klik ikon “copy to clipboard” (gambar kertas dobel, di sudut kanan atas kode sumber)
          3. Buka jendela Module1 di IDE VB6, klik kanan Paste.
          4. Buka jendela kode Form1 di IDE VB6, ketik kode berikut:

          Private Sub Form_Load()
              Call China(2012)
              MsgBox Imlek
          End Sub
          

          5. Jalankan program, akan tampil Message box tertulis pesan: 1/23/2012

  4. rahmanweb 18 Januari 2013 13:09 pukul 13:09

    kalo pake win XP lancar jaya om tapi kalo pake win7 imleknya g pas om…help me????

    • Novian Agung 18 Januari 2013 13:16 pukul 13:16

      Sepertinya itu pengaruh dari Regional Settingnya. Coba ganti Prosedur Trunc, menjadi seperti berikut:

      Function Trunc(dblValue As Double) As Long
      On Error Resume Next
      
          Dim strValue As String
          
          If dblValue = 0 Then
              Trunc = 0
              Exit Function
          End If
          
          Dim myDec As Integer
          Dim Pisah() As String
          
          myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
          
          If myDec  0 Then
              Pisah = Split(CStr(dblValue), ".")
              strValue = Pisah(0)
          Else
              myDec = InStr(1, CStr(dblValue), ",", vbTextCompare)
              If myDec  0 Then
                 Pisah = Split(CStr(dblValue), ",")
                  strValue = Pisah(0)
              Else
                  strValue = dblValue
              End If
          End If
          
          Trunc = CLng(strValue)
      End Function
      

      Untuk lebih jelasnya dan mendapatkan update kode terbaru, kunjungi grup Programmer VB Indonesia di Facebook, http://www.facebook.com/groups/programmervbindonesia/files

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: