Re: [twsocket] RFC 822 Date Time Conversion

2014-01-31 Thread Richard Gallois
: Richard Gallois g...@llois.com
 To: twsoc...@elists.org
 Sent: Thursday, January 30, 2014 1:29 PM
 Subject: [twsocket] RFC 822 Date Time Conversion


  Hi,

 Has anyone got a solid method of converting RFC 822 date times (e.g. Thu,
 30 Jan 2014 05:48:07 +0800) to a TDateTime. I've found a function in Indy
 to do this, but I'd rather not compile Indy into my project if there is an
 ICS way to do this.

 Many thanks,

 Richard
 --
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


 --
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] RFC 822 Date Time Conversion

2014-01-30 Thread Richard Gallois
Hi,

Has anyone got a solid method of converting RFC 822 date times (e.g. Thu,
30 Jan 2014 05:48:07 +0800) to a TDateTime. I've found a function in Indy
to do this, but I'd rather not compile Indy into my project if there is an
ICS way to do this.

Many thanks,

Richard
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] RFC 822 Date Time Conversion

2014-01-30 Thread Angus Robertson - Magenta Systems Ltd
 Has anyone got a solid method of converting RFC 822 date times 
 (e.g. Thu, 30 Jan 2014 05:48:07 +0800) to a TDateTime. 

There are RFC1123 date parsing functions in OverbyteIcsSmtpSrv.pas and
OverbyteIcsHttpProt.pas, but neither handle the time zone. 

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] RFC 822 Date Time Conversion

2014-01-30 Thread Michael Gasser



Hi Richard


maybe you should check the user made component LASTMOD.ZIP from
http://www.overbyte.be/frame_index.html?redirTo=/products/usermade.html

___

I use this code in two programs.

My programs did send me some error feedback while parsing 'LAST-MODIFIED:'
(html downloads with ICS HttpCli) with the inet component above (5 errors, 
~500'000 downloads).


Therefore I had to slightly modify the code:
Two modifications - see 1., 3.
___
1.
Right after begin add:
INetDate := trim( INetDate );

(2.)
If you use XEn:
if Uppercase(MonthName) = string(Months[IX]) then
instead of
if Uppercase(MonthName) = Months[IX] then

3.
after line
Delete(InetDate,1,Pos(' ',InetDate));
add this line:
if pos( ' ', inetdate ) = 0 then inetdate := inetdate + ' ';
___


If you  f.e. want to catch the value of LAST-MODIFIED of a html file using a 
THttpCli :


modify : event httpgetHeaderEnd


procedure TsjOnlineForm.httpgetHeaderEnd(Sender: TObject);
VAR
 IX : INteger;
 hst, ST : STring;
 szgmt, DT : tDateTime;

try
 for IX := 0 to Httpget.RcvdHeader.count-1 do
   BEGIN
 hst := Httpget.RcvdHeader.Strings[IX];

 if Pos('Content-Length:',hst)  0 then
   BEGIN
 ST := hst;
 Delete(ST,1,Pos(' ',ST));
   END
  else
   if Pos('LAST-MODIFIED:',Uppercase(hst))  0 then
   BEGIN
 ST := hst;
 Delete(ST,1,Pos(':',ST));
 DT.:= 0;
try
 DT := InetStdDateToDateTime(ST);
except
  senderrorFeedback_eMail_to_RichardGallois( 'cannot parse t=' 
+ ST );

   end,
___


Best regards
Michael


- Original Message - 
From: Richard Gallois g...@llois.com

To: twsoc...@elists.org
Sent: Thursday, January 30, 2014 1:29 PM
Subject: [twsocket] RFC 822 Date Time Conversion



Hi,

Has anyone got a solid method of converting RFC 822 date times (e.g. Thu,
30 Jan 2014 05:48:07 +0800) to a TDateTime. I've found a function in Indy
to do this, but I'd rather not compile Indy into my project if there is an
ICS way to do this.

Many thanks,

Richard
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be 


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be