Programmer 的進程 - 由 VB6 開始

Xojo / RealBasic 相關文件及程式庫 => Xojo / RealBasic 範例及函式庫 => Topic started by: admin on August 23, 2011, 07:33:40 PM

Title: 字串轉成時間的函數
Post by: admin on August 23, 2011, 07:33:40 PM
Code: [Select]
Function czParseTime(tmpTime as string, byref tmpTimeValue as double) As Boolean
  dim tmpResult as boolean=false
 
  if len(tmptime) >0 then
    dim tmpHour as integer = val(NthField(tmptime,":",1))
    dim tmpMinute as integer = val(NthField(tmptime,":",2))
    dim tmpSecond as integer = val(NthField(tmptime,":",3))
   
    if tmphour>0 or  tmpMinute=0 or tmpSecond=0 then
      tmptimevalue=((tmpHour *60*60)+(tmpMinute *60)+tmpSecond)/86400
      tmpResult=true
    end if
   
  end if
 
  return tmpResult
 
End Function