• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Date format

hello,

I have a field in '05/01/2006' format and I'd like to change it to '01-MAY-06' format in VB.net.
Any ideas?

Thanks,
0
mrong
Asked:
mrong
1 Solution
 
bruintjeCommented:
Hello mrong,

you could try something like
----------
Dim MyString As String = UCase(MyDate.ToString("d - MMM - yyyy"))
----------
where MyDate is your date variable

hope this helps a bit
bruintje
0
 
bruintjeCommented:
Dim MyString As String = UCase(MyDate.ToString("dd-MMM-yyyy"))
0
 
possekeCommented:
String.Format('05/01/2006', "dd-MMMM-yy") should work

On this site you have all the different types of Formats dat can be used to convert a date:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp

Read it !!

Greetz,

Po$$e
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Shiju SasidharanCommented:
or simply

       Format(CDate("05/01/2006"), "dd-MMM-yy")
0
 
bruintjeCommented:
problem with that is you get 'May' instead of 'MAY'
0
 
Shiju SasidharanCommented:

   UCase(Format(CDate("05/01/2006"), "dd-MMM-yy"))
0
 
mrongAuthor Commented:
Bruintje,

I tried your suggestions and got the following error:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.IFormatProvider'.


Shijusn, your code works for me.

Thank everyone of you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now