title: Is there any function that easy converts MBox date format to Delphi TDateTime format?
body: <p>MBox files, like Google Gmail export mailbox contains various types of data, among other things, the date of the mail message that interests me. The date of the message is in the format:</p>
  <pre><code>DayOfWeek, dd monthname yyyy hh:mm:ss +timezone
  Mon, 03 Jun 2019 15:32:25 +0200
  </code></pre>
  <p>I was looking for some ready-made function in Delphi that I could translate a date string into TDateTime. If the whole string is impossible to parse to TDateTime, I can only try parse this part:</p>
  <pre><code>dd monthname yyyy hh:mm:ss
  03 Jun 2019 15:32:25
  </code></pre>
  <p>but I admit that it is a bit of a hassle in my language to parse the month name. Could I ask for such a function if it exists? If such a ready-made function does not exist, I will make my own (or at least try).</p>
  <p>Thank you in advance!</p>
  <p>EDIT: SOLUTION</p>
  <p>My guess is that this may not be useful to anyone, but if someone will have a similar problem, have a solution here. You can probably write it more elegantly, but it works.</p>
  <pre><code>// You can make your own formats here
  const months : array[1..12,1..2] of string =
                          (('-01-',' Jan '),
                          ('-02-',' Feb '),
                          ('-03-',' Mar '),
                          ('-04-',' Apr '),
                          ('-05-',' May '),
                          ('-06-',' Jun '),
                          ('-07-',' Jul '),
                          ('-08-',' Aug '),
                          ('-09-',' Sep '),
                          ('-10-',' Oct '),
                          ('-11-',' Nov '),
                          ('-12-',' Dec '));
  
  function ChangeDateFormat(input: String): String;
  var i: Integer;
  begin
    // day name and timezone is not needed, so we cut it
    delete(input,1,Pos(',',input)+1);
    delete(input,Pos('+',input)-1, Length(input));
  
     for i := 1 to 12 do
        input := StringReplace(input,
        months[i,2],months[i,1],
        [rfReplaceAll, rfIgnoreCase]);
     result := Trim(input);
  end;
  </code></pre>
  <p>For 'Date: Mon, 03 Jun 2019 15:32:25 +0200' mbox date string it looks like</p>
  <pre><code>WriteLn(ChangeDateFormat('Date: Mon, 03 Jun 2019 15:32:25 +0200'));
  </code></pre>
  <p>it gives back</p>
  <pre><code>03-06-2019 15:32:25
  </code></pre>
  <p>which is already recognized e.g. by Excel and allows sorting or other operations.</p>
  <p>At the moment I haven't found any ready-made functions in Delphi.</p>