Question

Can I use leading zero in case of day in the Date field in SMTP?

I mean smth like

03 Apr 2014 13:10:22 +0000

Can you quote RFC, please?

Was it helpful?

Solution

There are no dates in the SMTP protocol, but you are probably referring to email header fields as described by RFC 2822 Internet Message Format. From http://www.ietf.org/rfc/rfc2822.txt we have section 3.3 Date and Time specification, with the following selected fields:

date-time       =       [ day-of-week "," ] date FWS time [CFWS]

day-of-week     =       ([FWS] day-name) / obs-day-of-week

day-name        =       "Mon" / "Tue" / "Wed" / "Thu" /
                        "Fri" / "Sat" / "Sun"

date            =       day month year

year            =       4*DIGIT / obs-year

month           =       (FWS month-name FWS) / obs-month

month-name      =       "Jan" / "Feb" / "Mar" / "Apr" /
                        "May" / "Jun" / "Jul" / "Aug" /
                        "Sep" / "Oct" / "Nov" / "Dec"

day             =       ([FWS] 1*2DIGIT) / obs-day
...

which states that the day part of the date should be between 1-2 digits, and this does not specifically prohibit using a leading zero. Nothing seems to be said about the optional leading zero, so proper interpretation should always allow it while parsing.

The obs- alternative variants describe old obsolete formats, e.g. 2-digit years and comments or folding white-space between any part.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top