You can define a string extension method, like:
public static class MyExtensions
{
public static string DateTimeConvert( this string source, string destFormat )
{
DateTime dateTime;
if ( DateTime.TryParse( source, out dateTime ) )
{
return dateTime.ToString( destFormat );
}
return null;
}
}
Usage:
static void MyCode()
{
const string source = "2013-09-04T14:00:00Z";
Console.WriteLine( "DateTime : " + source.DateTimeConvert( "MM/dd/yyyy hhmm" ) );
}