The FormatDateTime
function can be used to format a Unix timestamp in Delphi.
Here is an example:
var
UnixTimeStamp: Int64;
begin
UnixTimeStamp := UnixToDateTime(1625072399); // Convert Unix timestamp to Delphi TDateTime
ShowMessage(FormatDateTime('dd/mm/yyyy hh:nn:ss', UnixTimeStamp)); // Format TDateTime as a string
end;
In this example, the UnixToDateTime
function is used to convert the Unix timestamp to a Delphi TDateTime
value, which can then be formatted as a string using the FormatDateTime
function. The format string 'dd/mm/yyyy hh:nn:ss'
represents the desired output format of the timestamp.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-01-24 11:00:00 +0000
Seen: 11 times
Last updated: Oct 18 '22
Can the new position of a dynamically shifted control be saved in Delphi?
How can I show a checkmark in a Boolean field in Delphi's DBGrid?
How can memory leaks in UnicodeStrings be addressed in Delphi?
How can POST data be handled in the OnNavigate event when using Delphi TEdgeBrowser?
How can RxLib be used together with Delphi 11?
In Delphi, what is the method to obtain a numeric variant property?
How to display a form or a "please wait" panel while executing a task in FMX Delphi 10.2?