Senin, 29 September 2014

Menghitung Umur dengan vb.net 2010

Jika ingin menghitung umur dengan rincian tahun,bulan,dan hari misal
saya lahir pada tahun 24-09-1989 dan sekarang adalah tahun 29-09-2014 maka umur saya adalah:
 "25 tahun 0 bulan 5 hari".


berikut ini adalah kode vb.net 2010 :


 Public Function hit_tanggal(ByVal awal As Date, ByVal akhir As Date, ByRef hasil As String)
        Dim tahun, bulan

        tahun = akhir.Year - awal.Year
        bulan = akhir.Month - awal.Month

        If System.Math.Sign(bulan) <= 0 Then

            bulan = 12 - System.Math.Abs(bulan)

            tahun = tahun - 1

        End If
        hasil = tahun & " Tahun " & bulan & " Bulan"
    End Function

1 komentar:

  1. Casinos Near DC (Things to Know) - MapyRO
    The following four casinos (with map directions) 익산 출장샵 will 성남 출장샵 be chosen for your trip to DC and 거제 출장안마 will not be allowed 김제 출장샵 to play slots, roulette, blackjack or any 대구광역 출장마사지 other games.

    BalasHapus

how coffee can prevent cancer

Coffee and Cancer: An Examination of the Relationship   Coffee, one of the most consumed beverages worldwide, has been the subject of extens...