DATETIME SHORTING IN C#

Manmohan Jha

Total Post:35

Points:245
Posted by  Manmohan Jha
C# 
C#
 2324  View(s)
Ratings:
Rate this:
How to short list of month in MMMM-yy formate?????
  1. Chris Anderson

    Post:65

    Points:455
    Re: DateTime Shorting in c#

    String.Format("{0:MMMM-yy}",DateTime.Now)

  1. Manmohan Jha

    Post:35

    Points:245
    Re: DateTime Shorting in c#

    I've Solved this myself ...
    
    string str="Jan-14,Apr-13,Feb-14,May-13,Mar-14,Nov-13,Oct-13,Jun-13,Sep-13,Aug-13,Dec-13,Jul-13";
    In String >>>>
    string sortedlist = string.Join(",", str.Split(',').OrderBy(s => DateTime.ParseExact(s, "MMM-yy", CultureInfo.CurrentCulture)).ToArray());
    
    In ListBox >>>>
    listBox1.DataSource = str.Split(',').OrderBy(s => DateTime.ParseExact(s, "MMM-yy", CultureInfo.CurrentCulture)).ToArray();

      Modified On Apr-29-2014 08:40:45 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!