J
JD
I would like to know what is the preferred/best way to
format date values in VB.Net. Here is what I have
Dim str1 As String
str1 = txtDate.Text 'say 2/3/2005
I need 2/3/2005 to be 03FEB2005. Here is what I tried
str1 = txtDate.Text.ToString("ddMMMyyyy")
but I got an error message about System.IFormatProvider
something missing. I tried Imports System, still error.
So I then tried
str1 = Format(txtDate.Text, "ddMMMyyy")
which did work, and also tried
str1 = String.Format("ddMMMyyyy", txtDate.Text)
which also worked. But I know I have seen the
txtDate.Text.ToString("ddMMMyyyy") method somewhere. So
could someone suggest what is the preferred method to
format dates in VB.Net?
Thanks,
JD
format date values in VB.Net. Here is what I have
Dim str1 As String
str1 = txtDate.Text 'say 2/3/2005
I need 2/3/2005 to be 03FEB2005. Here is what I tried
str1 = txtDate.Text.ToString("ddMMMyyyy")
but I got an error message about System.IFormatProvider
something missing. I tried Imports System, still error.
So I then tried
str1 = Format(txtDate.Text, "ddMMMyyy")
which did work, and also tried
str1 = String.Format("ddMMMyyyy", txtDate.Text)
which also worked. But I know I have seen the
txtDate.Text.ToString("ddMMMyyyy") method somewhere. So
could someone suggest what is the preferred method to
format dates in VB.Net?
Thanks,
JD