Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,
How to convert a particular date to April,2009 in c#

Example:19/04/2009 to April,2009
Posted

Try DateTime myDateTime = DateTime.ParseExact( input, "MMMM yyyy" );
 
Share this answer
 
v2
Comments
Espen Harlinn 8-Feb-12 9:26am    
5'ed!
Abhinav S 8-Feb-12 9:29am    
Thank you Espen.
Try This

C#
string.Format("{0:MM-yyyy}", YourDate.Text)
 
Share this answer
 
v2
Hi,

See this link...
VB
SQL Server Date Formats

 
Share this answer
 
use DateTime.ToString(string format)

see this.

about function:

http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx[^]

What to pass as argument format:

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^]
 
Share this answer
 
<![CDATA[<%= String.Format("{specifier}", DateTime.Now) %>]]>

Specifier      Description         Output 
Y             Month / Year        April 2007 
 
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