問題:客戶現場程式執行提示時間格式不對導致的錯誤,原因是與開發環境及公司內部測試環境的日期格式不一致;
解決:統一強制轉換;
//引用單元:sysutils
//目的:實現跨環境相容不同日期格式,如果不做強制格式處理,不同環境存在發生問題的可能性;
function getsystimebyformate: string
; var
dtformate: tformatsettings;
begin
trydtformate.shortdateformat := '
yyyy/mm/dd
';
dtformate.dateseparator := '/'
; dtformate.longtimeformat := '
hh:mm:ss
';
dtformate.timeseparator := ':'
; result :=datetimetostr(now(),dtformate);
except
end;
end;
Delphi Format 格式化數字
function format const format string const args array of const string f...
Delphi的 Format格式化函式
自 其實在看delphi的format函式的時候,可以與c 裡面的printf 函式的格式化相關的知識進行類比。 首先看它的宣告 funct...