BẠN CẮT DÁN THEO NỘI DUNG DƯỚI ĐÂY FUNCTION AGE(DATE1 AS DATE, DATE...

3. Bạn cắt dán theo nội dung dưới đây Function Age(Date1 As Date, Date2 As Date) As String Dim Y As Integer Dim M As Integer Dim D As Integer Dim Temp1 As Date Temp1 = DateSerial(Year(Date2), Month(Date1), Day(Date1)) Y = Year(Date2) - Year(Date1) + (Temp1 > Date2) M = Month(Date2) - Month(Date1) - (12 * (Temp1 > Date2)) D = Day(Date2) - Day(Date1) If D < 0 Then M = M - 1 D = Day(DateSerial(Year(Date2), Month(Date2), 0)) + D End If Age = Y & " nam " & M & " thang " & D & " ngay" End Function