I am trying to convert this date format to “09/05/2018 14:30” a different format MMM-dd-yyyy HH:mm tt.
But I am getting the output as : Date in required format : May-09-2018 14:30:00 PM.
I need the output to be : Date in required format : May-09-2018 02:30:00 PM (need 02 instead of 14 in hour field)
The following are the steps which i did
converted to DateTime datttte-> DateTime.ParseExact("09/05/2018 14:30", "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture)
Converted to String in required format → datttte.ToString("MMM-dd-yyyy HH:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture)
Could you please help me,