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

asp 格式化時間日期

2013-11-13 10:44:34  來源: .NET編程 

  asp教程 格式化時間日期

  public function formatdt(dt style)

  style= 下午 ::

  style= ::

  style= :

  style= :

  style= :

  style=

  style=

  style=

  style= hms

  style=

  style=    上傳圖片

  style=

  style= //   上傳圖片

  dim nowdate y m d h i s t apm hapm

  nowdate = dt

  y = year(nowdate)

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

  m = month(nowdate)

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

  d = day(nowdate)

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

  h = hour(nowdate)

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

  i = minute(nowdate)

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

  s = second(nowdate)

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

  if h > then

  apm = "下午 "

  hapm = cstr(cint(h) mod )

  else

  apm = "上午 "

  hapm = h

  end if

  select case style

  case

  t = y & "" & m & "" & d & " " & apm & hapm & ":" & i & ":" & s

  case

  t = y & "" & m & "" & d & " " & h & ":" & i & ":" & s

  case

  t = y & "" & m & "" & d & " " & h & ":" & i

  case

  t = right(y ) & "" & m & "" & d & " " & h & ":" & i

  case

  t = m & "" & d & " " & h & ":" & i

  case

  t = y & "" & m & "" & d

  case

  t = right(y ) & "" & m & "" & d

  case

  t = m & "" & d

  case

  t = h & "h" & i & "m" & s &"s"

  case

  t = y & m & d & h & i & s

  case 上傳

  t = right(y ) & m

  case

  t = right(y ) & "年" & m & "月" & d & "日"

  case

  t = right(y ) & "/" & m & "/" & d

  end select

  formatdt = t

  end function


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