I want to display date in 09/07/2013 format instead of 09-jul-13.
Dim dt As Date = Date.Today
MsgBox(dt)
First, uppercase MM are months and lowercase mm are minutes.
You have to pass CultureInfo.InvariantCulture
to ToString
to ensure that /
as date separator is used since it would normally be replaced with the current culture's date separator:
MsgBox(dt.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture))
Another option is to escape that custom format specifier by embedding the / within ':
dt.ToString("dd'/'MM'/'yyyy")
MSDN: The "/" Custom Format Specifier:
The "/" custom format specifier represents the date separator, which is used to differentiate years, months, and days. The appropriate localized date separator is retrieved from the
DateTimeFormatInfo.DateSeparator
property of the current or specified culture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With