Display date in dd/mm/yyyy format in vb.net

后端 未结 7 1930
独厮守ぢ
独厮守ぢ 2021-01-11 11:08

I want to display date in 09/07/2013 format instead of 09-jul-13.

Dim dt As Date = Date.Today

MsgBox(dt)
7条回答
  •  温柔的废话
    2021-01-11 11:55

    I found this catered for dates in 21st Century that could be entered as dd/mm or dd/mm/yy. It is intended to print an attendance register and asks for the meeting date to start with.

    Sub Print_Register()
    
    Dim MeetingDate, Answer
    
        Sheets("Register").Select
        Range("A1").Select
    GetDate:
        MeetingDate = DateValue(InputBox("Enter the date of the meeting." & Chr(13) & _
        "Note Format" & Chr(13) & "Format DD/MM/YY or DD/MM", "Meeting Date", , 10000, 10000))
        If MeetingDate = "" Then GoTo TheEnd
        If MeetingDate < 36526 Then MeetingDate = MeetingDate + 36526
        Range("Current_Meeting_Date") = MeetingDate
        Answer = MsgBox("Date OK?", 3)
        If Answer = 2 Then GoTo TheEnd
        If Answer = 7 Then GoTo GetDate
        ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
    TheEnd:
    End Sub
    

提交回复
热议问题