🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mail.headers
Article #266

Re: Date HELP !!!

#266
From: Kari E. Hurtta
Date: Mon, 21 Aug 1995 06:20
107 lines
5479 bytes
[ Followups to comp.mail.headers. 
  It talks about STD 11 (RFC 822). ]

jatmon@iag.net (John R Buchan (jatmon)) writes in comp.mail.headers
and comp.lang.c:
»In article <41841c$jn6@elron2.elron.net>, teletel@elronet.co.il says...
»>I need a "c" source code for converting
»>litral date in the "Date:" field of E-Mail Header
»>into a simple "YYMMDD" format

»Assuming that the format of the string remains constant
»you could try sscanf with a format string similar to:

»"%*s %[^,], %d %s %d %d:%d:%d %s"

Notice that weekday is optional. Quote from grammal of STD 11 (RFC 822):

|     date-time   =  [ day "," ] date time        ; dd mm yy
|                                                 ;  hh:mm:ss zzz
|
|
|     day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
|                  /  "Fri"  / "Sat" /  "Sun"
| 
|     date        =  1*2DIGIT month 2DIGIT        ; day month year
|                                                 ;  e.g. 20 Jun 82
|
|     time        =  hour zone                    ; ANSI and Military
|
|     hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
|                                                 ; 00:00:00 - 23:59:59
| 
|     zone        =  "UT"  / "GMT"                ; Universal Time
|                                                 ; North American : UT
|                 /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
|                 /  "CST" / "CDT"                ;  Central:  - 6/ - 5
|                 /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
|                 /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
|                 /  1ALPHA                       ; Military: Z = UT;
|                                                 ;  A:-1; (J not used)
|                                                 ;  M:-12; N:+1; Y:+12
|                 / ( ("+" / "-") 4DIGIT )        ; Local differential
|                                                 ;  hours+min. (HHMM)

STD 3 (RFC 1123) changes this:

|       5.2.14  RFC-822 Date and Time Specification: RFC-822 Section 5
| 
|          The syntax for the date is hereby changed to:
| 
|             date = 1*2DIGIT month 2*4DIGIT
| 
|          All mail software SHOULD use 4-digit years in dates, to ease
|          the transition to the next century.
| 
|          There is a strong trend towards the use of numeric timezone
|          indicators, and implementations SHOULD use numeric timezones
|          instead of timezone names.  However, all implementations MUST
|          accept either notation.  If timezone names are used, they MUST
|          be exactly as defined in RFC-822.
| 
|          The military time zones are specified incorrectly in RFC-822:
|          they count the wrong way from UT (the signs are reversed).  As
|          a result, military time zones in RFC-822 headers carry no
|          information.
| 
|          Finally, note that there is a typo in the definition of "zone"
|          in the syntax summary of appendix D; the correct definition
|          occurs in Section 3 of RFC-822.

I don't found defination of "zone" from Section 3 of RFC-822. Instead it is
in Section 5:

|      5.  DATE AND TIME SPECIFICATION
| 
|      5.1.  SYNTAX
| 
|      date-time   =  [ day "," ] date time        ; dd mm yy
|                                                  ;  hh:mm:ss zzz
| 
|      day         =  "Mon"  / "Tue" /  "Wed"  / "Thu"
|                  /  "Fri"  / "Sat" /  "Sun"
| 
|      date        =  1*2DIGIT month 2DIGIT        ; day month year
|                                                  ;  e.g. 20 Jun 82
| 
|      month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"
|                  /  "May"  /  "Jun" /  "Jul"  /  "Aug"
|                  /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"
| 
|      time        =  hour zone                    ; ANSI and Military
| 
|      hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]
|                                                  ; 00:00:00 - 23:59:59
| 
|      zone        =  "UT"  / "GMT"                ; Universal Time
|                                                  ; North American : UT
|                  /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
|                  /  "CST" / "CDT"                ;  Central:  - 6/ - 5
|                  /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
|                  /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
|                  /  1ALPHA                       ; Military: Z = UT;
|                                                  ;  A:-1; (J not used)
|                                                  ;  M:-12; N:+1; Y:+12
|                  / ( ("+" / "-") 4DIGIT )        ; Local differential
|                                                  ;  hours+min. (HHMM)
| 
Technical Details
Message-ID: <4198k7$rll@kronos.fmi.fi>
Path: arc1-ca.pugleaf.net!dionysos.fmi.fi!hurtta
References: <41841c$jn6@elron2.elron.net> <418jaj$amq@news.iag.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!dionysos.fmi.fi!hurtta
From: hurtta@dionysos.fmi.fi (Kari E. Hurtta)
Newsgroups: comp.mail.headers,comp.lang.c
Subject: Re: Date HELP !!!
Followup-To: comp.mail.headers
Date: 21 Aug 1995 06:20:55 GMT
Organization: Finnish Meteorological Institute (FMI)
Message-ID: <4198k7$rll@kronos.fmi.fi>
References: <41841c$jn6@elron2.elron.net> <418jaj$amq@news.iag.net>
NNTP-Posting-Host: dionysos.fmi.fi
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
In-Reply-To: Article <418jaj$amq@news.iag.net> of John R Buchan 
X-Newsreader: NN version 6.5(beta3).0 #6 (NOV)