So I'm using an API where a datetime is retrieved in the following format DIE, 28. AUG 2018 12:38:38
The closest datetime format I found was this ddd, dd. MMM yyyy HH:mm:ss
.
It works only if its DI
, but the API provides this day as DIE
.
Does a format exist that can parse DIE, 28. AUG 2018 12:38:38
I believe that the developers of this API use some different format.
Does anyone know what it could be ?
EDIT: some code I tried
static void Main(string[] args)
{
const string DateTimeFormat = "ddd, dd. MMM yyyy HH:mm:ss";
var deCultureInfo = new CultureInfo("de-DE");
string input = "DIE, 28. AUG 2018 14:12:01";
// both throws exception
var timestamp1 = DateTime.ParseExact(input, DateTimeFormat, deCultureInfo);
var timestamp2 = DateTime.Parse(input, deCultureInfo);
//Console.WriteLine(DateTime.Now.ToString(deCultureInfo));
}
MON, 27. AUG 2018 12:38:38
works. Week days are usually abbreviated with only 2 letters in Germany. And the only 3 letter week day that works withDateTime.Parse
is money withMon
. – Tutelage