if you have datetime in string format like "12/05/2014 12:17:20" then better convert this to a DateTime type. DateTime can be convert to string format by giving the format which we needed.
for the String to DateTime conversion use
DateTime.ParseExact[
^] or
DateTime.TryParseExact[
^] methods
When you have the DateTime object, call the ToString method with custom format string as you need. Check
Custom Date and Time Format Strings[
^] for more information.
Sample code:
DateTime dt = DateTime.ParseExact("12/05/2014 12:17:20", "MM/dd/yyyy hh:mm:ss", CultureInfo.InvariantCulture);
string result =dt.ToString("dd MMM yyyy hh:mm:ss");