Hi Arnaldo
If you look at the source of FormatDateTime M is replaced by N if the
preceding formatting character is H. I'm not quite sure if this works
correctly, it won't hurt to change it to "nn" anyway.
All:
I checked FormatDateTime routines and they are all the same (regarding
speed).
So a call like
Result := DateToStr (t, RFC822_FormatSettings) + ' '
+ Time(t,RFC822_FormatSettings) + ' '
+ TimeZoneBias
with the following constant
RFC822_FormatSettings : TFormatSettings = (
CurrencyFormat: 3;
NegCurrFormat: 8;
ThousandSeparator: ',';
DecimalSeparator: '.';
CurrencyDecimals: 2;
DateSeparator: '.';
TimeSeparator: ':';
ListSeparator: ';';
CurrencyString: '€';
ShortDateFormat: 'dd.MM.yyyy';
LongDateFormat: 'ddd, d mmm yyyy hh:nn:ss';
TimeAMString: '';
TimePMString: '';
ShortTimeFormat: 'hh:nn:ss';
LongTimeFormat: 'hh:nn:ss';
ShortMonthNames: ('Jan', 'Feb', 'Mar', 'Apr', 'May',
'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
LongMonthNames: ('January', 'February', 'March',
'April', 'May', 'June', 'July', 'Augut', 'September', 'October',
'November', 'December');
ShortDayNames: ('Sun', 'Mon', 'Tue', 'Wed', 'Thu',
'Fri', 'Sat');
LongDayNames: ('Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday', 'Friday', 'Saturday');
TwoDigitYearCenturyWindow: 0;);
would be easier to read.
Moreover according to Delphi Help it would be thread save in opposition
to a call without a TFormatSettings parameter.
Veit
Arnaldo Braun wrote:
> Hi
>
> A small typo in
>
> hh:mm:ss
>
> must be corrected to
>
> hh:nn:ss or hh":"nn":"ss
>
> MM is month and NN is minute
>
>
>
>
> Veit Zimmermann wrote:
>
>> Marcello Vezzelli wrote:
>>
>>
>>> Hi all,
>>> there is a bug in SmtpProt.pas (latest ics version just downloaded),
>>> function Rfc822DateTime, line 2892 and 2907, FormatDateTime function.
>>>
>>> Result := FormatDateTime('ddd, d mmm yyyy hh:mm:ss', t) +
>>> ' ' + TimeZoneBias
>>>
>>> The time separator : should be put between double quotes, like this:
>>>
>>> Result := FormatDateTime('ddd, d mmm yyyy hh":"mm":"ss', t) +
>>> ' ' + TimeZoneBias
>>>
>>> Otherwise the system default time separator would be used (in italian
>>> localization, default time separator is '.').
>>>
>>> Regards
>>>
>>>
>> I know this comes a little bit late, but...
>>
>> In the same function it is tested for English/US format by only
>> comparing the first day (Sunday). Does anyone know if there is
>> any other language where the Sunday is also abbreviated as "sun"
>> but other days or months differ?
>>
>> if ShortDayNames[1] = MyShortDayNames[1] then
>> Result := FormatDateTime('ddd, d mmm yyyy hh":"mm":"ss', t) +
>> ' ' + TimeZoneBias
>>
>> Francois, why do you test at all and don't use TFormatSettings
>> for all those functions? Is it performance? I don't know if the
>> overloaded FormatDateTime function with TFormatStettings is slower.
>> At least it makes the code much more readable and shorter (despite
>> the definition of the TFormatSettings as a constant).
>>
>> Veit
>>
>>
>
--
*********************************************************************
* Dipl.-Ing. Veit Zimmermann [EMAIL PROTECTED] *
* VECTRONIC Aerospace GmbH www.vectronic-aerospace.com *
* Carl-Scheele-Str. 12 tel: +49 (0)30 6789 4990 *
* D-12489 Berlin fax: +49 (0)30 6789 5230 *
* Germany WGS84: 52°25.83'N 13°31.52'E *
*********************************************************************
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be