Convert Date to any format from any other format

June 30, 2012

Convert a one date format to any other date format.
Date format must not be a regular Date format like ‘MM/dd/yyyy’. it can be a any format like ‘yyyyMMdd’

Coding :

public string DateFormatter(string Date,string RevFormat,string ReqFormat)
DateTime MyDateConverted = DateTime.ParseExact(Date, RevFormat, System.Globalization.CultureInfo.InvariantCulture);
string ReqDate = MyDateConverted.ToString(@ReqFormat);
return ReqDate;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: