FileMaker的內部存儲時間標記是一個簡單的,因爲當天午夜經過的秒數。
即自午夜以來56659秒= 3:44:19 PM。
當導出數據,可以勾選「應用當前佈局的數據格式,以導出數據」複選框,這樣時間顯示在FMP佈局24小時是出口這樣。
但是,對於其他內部使用,如你問有關文件命名時,您需要使用自定義函數來獲取(currentTime的)的輸出轉換爲24小時格式。
例如,請參閱Briandunning.com上的TimeFormatAs (theTime ; type12or24)函數。 (自定義功能的完整代碼粘貼下面針對將來死鏈接的保護,但如果上面的鏈接仍然有效,使用該版本,因爲它可能會更高達最新:)
/*---------------------------------------------------------------
Function Name: TimeFormatAs
Syntax: TimeFormatAs (theTime; type12or24)
Author - Jonathan Mickelson, Thought Development Corp.
(www.thought-dev.com)
---------------------------------------------------------------*/
Case (not IsEmpty (theTime) ;
Let (
[
// FIXED VARIABLES
padHoursChar = "" ; // Character to pad the Hours with in a text result, (Ex."0", " ", "")
padAMPMChar = " " ; // Character to pad the AM/PM with in a text result, (Ex."0", " ", "")
suffixAM = "AM" ; // <------------ CHANGE AM Suffix Here
suffixPM = "PM" ; // <------------ CHANGE PM Suffix Here
// DYN. VARIABLES
theTime = GetAsTime (theTime) ;
hasSeconds = PatternCount (GetAsText (theTime) ; ":") = 2 ;
secs = Mod (Seconds (theTime) ; 60) ;
mins = Mod (Minute (theTime) ; 60) + Div (Seconds (theTime) ; 60) ;
hours = Hour (theTime) + Div (Minute (theTime) ; 60) ;
// -------------- BEGIN 24 HOUR TIME CALC ----------------------
result24 = GetAsTime (theTime) + 1 - 1 ;
// -------------- BEGIN 12 HOUR TIME CALC ----------------------
hours = Mod (Hour (theTime) ; 12) ;
tempHours = Case ((hours < 1) or (hours - 12 = 0) ; 12 ; hours) ;
calc12Hours =
Left (
padHoursChar & padHoursChar ;
2 - Length (tempHours)
) &
tempHours ;
calc12Minutes = Left ("00" ; 2 - Length (mins)) & mins ;
calc12Seconds = Left ("00" ; 2 - Length (secs)) & secs ;
calc12Suffix = Case (Mod (Hour (theTime) ; 24) >= 12 ; suffixPM ; suffixAM) ;
result12 = calc12Hours &
":" & calc12Minutes &
// if original time included a non-zero seconds value, display seconds
Case (hasSeconds and secs > 0 ; ":" & calc12Seconds) &
padAMPMChar & calc12Suffix
] ;
Case (type12or24 >= "24" ; result24 ; result12) // END CASE
) // END LET
) // END CASE
另請參閱:http://help.filemaker.com/app/answers/detail/a_id/5746/~/formatting-times-in-a-text-calculation – pft221
非常感謝。我看過這個劇本但決定尋找更直接的東西。最後,我只是使用可用時間格式導出並使用外部腳本進行轉換。這樣做麻煩較少。 – brannerchinese