熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 格式化時間函數

2022-06-13   來源: .NET編程 

  asp教程 格式化時間函數

  本款函數可以根據用戶給定的時間日期進行年月日時分秒等只要用戶給定不同的style參數就可以顯示不同風格的時間日期

  function formattime(testtimestyle)

  dim nyrsfm

  n = year(testtime)

  y = month(testtime)

  r = day(testtime)

  s = hour(testtime)

  f = minute(testtime)

  m = second(testtime)

  if len(n) = then n = "" & n

  if len(y) = then y = "" & y

  if len(r) = then r = "" & r

  if len(s) = then s = "" & s

  if len(f) = then f = "" & f

  if len(m) = then m = "" & m

  nn=right(n)

  if style = then

  formattime = ""& n &"年"& y &"月"& r &"日"& s &"時"

  elseif style = then

  formattime = r &"日 "& s & ":" & f & ":" & m

  elseif style = then

  formattime = n &"年"& y &"月"& r &"日"

  elseif style = then

  formattime = n & "" & y & "" & r & " " & s & ":" & f

  elseif style = then

  formattime = y &""& r &" " & s & ":" & f

  elseif style = then

  formattime = n &"年"& y &"月"& r &"日" & s &":"& f

  elseif style = then

  formattime = n & y & r & s & f & m

  elseif style = then

  formattime = n & "" & y & "" & r

  elseif style = then

  formattime = n & "/" & y & "/" & r

  end if

  end function


From:http://tw.wingwit.com/Article/program/net/201311/14117.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.