Programmer 的進程 - 由 VB6 開始

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

Title: SQLDateTime 格式字串轉成 Double 的函數
Post by: admin on August 23, 2011, 07:37:08 PM
Code: [Select]
Function SQLDateTimetoDbl(tmpDateTime as string) As double
  dim tmpResult as double
  dim tmpSQLDateTime as string
  dim tmpYear as string
  dim tmpMonth as string
  dim tmpDay as string
  dim tmpTime as string
  dim d as new date
 
  if len(tmpdatetime) =17 then
    tmpyear=left(str(d.year),2)+left(tmpdatetime,2)
    tmpmonth=mid(tmpDateTime,4,2)
    tmpday=mid(tmpdatetime,7,2)
    tmpTime=right(tmpdatetime,8)
   
    tmpSQLDateTime=tmpyear +"-"+tmpmonth +"-" +tmpday +" " + tmptime
    d.SQLDateTime=tmpsqldatetime
   
    tmpResult=datetodbl(d)
   
  else
    d=new date
    tmpresult=datetodbl(d)
  end if
 
  return tmpresult
     
End Function