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