Skip to content

Commit

Permalink
refactor: Better date/time formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarreno committed Dec 9, 2024
1 parent 472bb0b commit 6c1d650
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/database/irclogbot.database.pas
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ procedure TDatabase.Insert(ANickName, AChannel, AMessage: String);

function TDatabase.Get(ACount: Integer): TStringList;
var
timestamp: TDateTime;
date, channel, nick, message: String;
begin
Result:= TStringList.Create;
Expand All @@ -109,11 +108,7 @@ function TDatabase.Get(ACount: Integer): TStringList;
begin
FQuery.First;
repeat
timestamp:= FQuery.FieldByName('timestamp').AsDateTime;
date:= FormatDateTime(
DefaultFormatSettings.ShortDateFormat + ' ' + DefaultFormatSettings.LongTimeFormat,
timestamp
);
date:= FQuery.FieldByName('timestamp').AsString;
channel:= FQuery.FieldByName('channel').AsString;
nick:= FQuery.FieldByName('nick').AsString;
message:= FQuery.FieldByName('message').AsString;
Expand Down
1 change: 1 addition & 0 deletions src/paslogbot.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ procedure TPasLogBot.DoRun;
//debug('Short Date: ' + DefaultFormatSettings.ShortDateFormat);
//debug('Short Time: ' + DefaultFormatSettings.ShortTimeFormat);
//debug('Date Sep: ' + DefaultFormatSettings.DateSeparator);
debug('Setting Date and Time formats');
DefaultFormatSettings.ShortDateFormat:= 'yyyy/mm/dd';
DefaultFormatSettings.DateSeparator:= '/';
debug(Format('Attempting to read config from: "%s"...', [FConfigFile]));
Expand Down

0 comments on commit 6c1d650

Please sign in to comment.