0

I have string with the text "Wed, 03 Aug 2011 18:51:33 +0000"

How can I convert it to date format e.g. 03/08/2011 18:51:33

var myDate : TDateTime;

begin myDate := StrToDate('Wed, 03 Aug 2011 18:51:33 +0000'); ShowMessage(DateTimeToStr(myDate));

end;

ERROR: 'Wed, 03 Aug 2011 18:51:33 +0000' is not a valid date

user3189644
  • 157
  • 2
  • 10
  • 2
    You want to convert from one text format to another? – David Heffernan Jan 13 '14 at 09:56
  • I want to convert string to date. String:Wed, 03 Aug 2011 18:51:33 +0000 -> to date : 03/08/2011 18:51:33 – user3189644 Jan 13 '14 at 09:58
  • 3
    @user3189644 By "date", do you mean a string in the format you gave, or a `TDateTime`? – CodesInChaos Jan 13 '14 at 10:00
  • 1
    Show some minimal effort/knowledge. – Sliq Jan 13 '14 at 10:38
  • What do you call by date? as of now you shown just two strings, "Wed, 03 Aug 2011 18:51:33 +0000" and "03/08/2011 18:51:33" - they both are just strings – Arioch 'The Jan 13 '14 at 11:05
  • Here is what I have tried. I'm Receiving error message: 'Wed, 03 Aug 2011 18:51:33 +0000' is not a valid date var myDate : TDateTime; begin myDate := StrToDate('Wed, 03 Aug 2011 18:51:33 +0000'); ShowMessage(DateTimeToStr(myDate)); end; – user3189644 Jan 13 '14 at 15:40

0 Answers0