請問這段程式的註解 關於年月日

拜託各位大大這段是什麼意思 ><

Public Function getdate(ByVal format As String) As String

Dim r As String = ""

If format = "TAIWAN" Then

r = "民國" + CStr(year - 1911) + "年" + CStr(month) + "月" + CStr(day) + "日"

Else

r = getdate()

End If

Return r

End Function

1 Answer

Rating
  • 7 years ago
    Favorite Answer

    基本上就是民國年的轉換

    Public Function getdate(ByVal format As String) As String

    -> 傳入一個字串變數 format

    Dim r As String = ""

    -> 定義字串變數 r

    If format = "TAIWAN" Then

    -> 如果 foramt 變數 = "TAIWAN"

    r = "民國" + CStr(year - 1911) + "年" + CStr(month) + "月" + CStr(day) + "日"

    -> r = 西元年轉換成民國年

    Else

    r = getdate()

    -> 如果 foramt 變數 != "TAIWAN",r 變數 = 今天的西元日期

    End If

    Return r

    -> 傳回 r 字串變數

    2012-11-06 00:25:19 補充:

    -> r = 西元日期轉換成民國日期

Still have questions? Get your answers by asking now.