Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to convert month number to text like 05=May, 04=Jun, 01=Jan
20/02/2021
oDate.Month
month show only 2 i want to it show "Feb"
actual I want to convert it dd/MMM/YYYY format

What I have tried:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim iDate As String = txtdt.Text
        Dim oDate As DateTime = DateTime.Parse(iDate)
        MsgBox(oDate.Day & " " & oDate.Month & "  " & oDate.Year)
    End Sub
Posted
Updated 20-Feb-21 3:09am
Comments
[no name] 20-Feb-21 9:06am    
Ralf Meier 20-Feb-21 9:09am    
You should post it as Solution ...
[no name] 20-Feb-21 9:19am    
Thanks, but I'm on thin ice when there are questions related to vb, that's why just as a comment on my part.
Ralf Meier 20-Feb-21 10:48am    
I would have posted only that what you wrote in your comment. In fact the answer is the reference to the "toString"-,method and it's using ...

1 solution

Example from DateAndTime.MonthName(Int32, Boolean) Method (Microsoft.VisualBasic) | Microsoft Docs[^]
Dim thisMonth As Integer
Dim name As String
thisMonth = 4
' Set Abbreviate to True to return an abbreviated name.
name = MonthName(thisMonth, True)
' name now contains "Apr".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900