02
2019
08

格式化时间函数

Function formatdate(byval sdate,byval stype)
          Dim y,m,d,h,n,s,otime
          y = Year(sdate)
          m = right("00" & Month(sdate),2)
          d = right("00" & Day(sdate),2)
          h = right("00" & Hour(sdate),2)
          n = right("00" & Minute(sdate),2)
          s = right("00" & Second(sdate),2)
          otime = stype
          otime = Replace(otime,"timestamp",DateDiff("s","1970-01-01 00:00:00",sdate))  
          otime = Replace(otime,"y",y)
          otime = Replace(otime,"m",m)
          otime = Replace(otime,"d",d)
          otime = Replace(otime,"h",h)
          otime = Replace(otime,"n",n)
          otime = Replace(otime,"s",s)
          formatdate = otime
End Function

« 上一篇下一篇 »