Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear Coders,

Today i was trying to convert the today's date month into string but not getting the same so i am putting this for you expert out there.

The Task:

If date is like 30/08/2012 then the 08 should be shown as AUG.
If date is like 20/10/2012 then the 10 should be shown as OCT.

Is this possible with the inbuilt function of vb.net 2010 or have to specify the same in a select case or some other fashion.

Thanks & Regards.
Posted
Updated 3-Sep-12 6:56am
v4

Yes you can do that, this is an example how, http://www.dotnetperls.com/datetime-format-vbnet[^]
 
Share this answer
 
Comments
Manas Bhardwaj 30-Aug-12 11:11am    
+5
[no name] 30-Aug-12 11:28am    
Thanks
vinay.sarmalkar 30-Aug-12 13:02pm    
thnxs alot
[no name] 30-Aug-12 14:09pm    
You're welcome
Try this one:
VB
Dim monthName As String= New DateTime(2012, 08, 30)
    .ToString("MMM", CultureInfo.InvariantCulture)


Hope it helps
 
Share this answer
 
Comments
Manas Bhardwaj 30-Aug-12 11:11am    
Yes +5!
vinay.sarmalkar 30-Aug-12 12:46pm    
Dear Manas,

It worked..thnxs..
Answers from Wes and Christian are good. You should also read more about Custom Date Formats at MSDN:

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^]
 
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