I want to format today's date like this dd/mm/yyyy Please help me

Recommended Answers

All 8 Replies

Dim thisDate1 As Date = Now
Debug.Writeline(thisDate1.ToString("dd/mm/yyyy"))

As daniel955 says, you should watch that capitalisation, "mm" is actually minutes in VB.NET as in "hh:mm:ss" e.g. "28/10/2013 11:30:44" is "dd/MM/yyyy hh:mm:ss" but if you had converted this date to "dd/mm/yyyy" you would get this string "28/30/2013" (28th day, 30 minutes, year 2013)

Dim Date1 As DateTime = DateTime.Now()
Debug.Writeline(Date1.ToString("d"))

Hi Xerohomicide,

Doesn't the .Tostring("d"), (short date) depend on your system locale settings?

Sub Main()

    ' Use current time.


' ... Use a format.
' ... Write to console.
Dim time As DateTime = DateTime.Now
Dim format As String = "MMM ddd d HH:mm yyyy"
Console.WriteLine(time.ToString(format))
End Sub

May Tue 18 16:46 2010

Dim thisDate1 As Date = Now
Debug.Writeline(thisDate1.ToString("dd/mm/yyyy"))

KimberGariando see earlier postings mm gives minutes not month (MM)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.