Skip to content

Commit 6c1d650

Browse files
committed
refactor: Better date/time formatting.
1 parent 472bb0b commit 6c1d650

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/database/irclogbot.database.pas

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ procedure TDatabase.Insert(ANickName, AChannel, AMessage: String);
9090

9191
function TDatabase.Get(ACount: Integer): TStringList;
9292
var
93-
timestamp: TDateTime;
9493
date, channel, nick, message: String;
9594
begin
9695
Result:= TStringList.Create;
@@ -109,11 +108,7 @@ function TDatabase.Get(ACount: Integer): TStringList;
109108
begin
110109
FQuery.First;
111110
repeat
112-
timestamp:= FQuery.FieldByName('timestamp').AsDateTime;
113-
date:= FormatDateTime(
114-
DefaultFormatSettings.ShortDateFormat + ' ' + DefaultFormatSettings.LongTimeFormat,
115-
timestamp
116-
);
111+
date:= FQuery.FieldByName('timestamp').AsString;
117112
channel:= FQuery.FieldByName('channel').AsString;
118113
nick:= FQuery.FieldByName('nick').AsString;
119114
message:= FQuery.FieldByName('message').AsString;

src/paslogbot.lpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ procedure TPasLogBot.DoRun;
132132
//debug('Short Date: ' + DefaultFormatSettings.ShortDateFormat);
133133
//debug('Short Time: ' + DefaultFormatSettings.ShortTimeFormat);
134134
//debug('Date Sep: ' + DefaultFormatSettings.DateSeparator);
135+
debug('Setting Date and Time formats');
135136
DefaultFormatSettings.ShortDateFormat:= 'yyyy/mm/dd';
136137
DefaultFormatSettings.DateSeparator:= '/';
137138
debug(Format('Attempting to read config from: "%s"...', [FConfigFile]));

0 commit comments

Comments
 (0)