ShortDateFormat and NLS_DATE_FORMAT

JosAikema

Member
Is there a function to convert the Delphi Shortdateformat in NLS_DATE_FORMAT and also from NLS_DATE_FORMAT in SHortDateFormat?
Regards,

Jos Aikem
 
This is a reasonable approximation for an NLS_DATE_FORMAT to a ShortDateFormat:
Code:
function NlsToWindows(const NlsDateFormat: string): string;
begin
  Result := NlsDateFormat;
  Result := StringReplace(Result, 'FM', '', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, 'MONTH', 'MMMM', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, 'MON', 'MMM', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, 'RRRR', 'YYYY', [rfReplaceAll, rfIgnoreCase]);
  Result := StringReplace(Result, 'RR', 'YY', [rfReplaceAll, rfIgnoreCase]);
end;
I don't have this example for the opposite conversion, but I'm sure you can figure this out
wink.gif
.

------------------
Marco Kalter
Allround Automations
 
Back
Top