Wednesday, December 17, 2008

To Get ShortDate in C#.net

Hi,
we can get the ShortDate using the following function,

public string GetShortDate(object aDate)
{
DateTime actualDate = (DateTime)aDate;
string shortDate = "";
string month = actualDate.ToLongDateString();
string[] mon = month.Split(',');
string date = mon[1];
string year = mon[2];
shortDate = date + year;
return shortDate;
}

No comments: