Author Topic: 字串轉成時間的函數  (Read 4142 times)

admin

  • Administrator
  • *****
  • Posts: 0
    • View Profile
字串轉成時間的函數
« 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

« Last Edit: October 23, 2011, 01:48:32 AM by Roy Chan »