CSharp examples for System:DateTime Month
Converts the date to a string containing month and day values ( culture-specific ).
// Copyright by the Spark Development Network using System;//from w w w. j a v a 2s .c o m public class Main{ /// <summary> /// Converts the date to a string containing month and day values ( culture-specific ). /// </summary> /// <param name="dateTime">The date time.</param> /// <returns></returns> public static string ToMonthDayString( this DateTime dateTime ) { var dtf = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat; string mdp = dtf.ShortDatePattern; mdp = mdp.Replace( dtf.DateSeparator + "yyyy", "" ).Replace( "yyyy" + dtf.DateSeparator, "" ); return dateTime.ToString( mdp ); } }