Dim beginwork As String = txt_beginwork.Text
Dim DateNow As String = CStr(Format(Date.Today(), "dd/MM/yyyy"))
Dim Day As String = CStr(DateDiff(DateInterval.Day, CDate(beginwork), CDate(DateNow)))
Dim Month As String = CStr(DateDiff(DateInterval.Month, CDate(beginwork), CDate(DateNow)))
Dim Year As String = CStr(DateDiff(DateInterval.Year, CDate(beginwork), CDate(DateNow)))
ลองใช้ DateDiff แล้วแต่ค่าที่ได้ยังไม่ตรงน่ะค่ะ
Tag : .NET, Ms SQL Server 2008, Web (ASP.NET), VS 2010 (.NET 4.x)