zoukankan      html  css  js  c++  java
  • ASP格式化时间日期(一)

    Function FormatDate(DateAndTime, Format)
      On Error Resume Next
      Dim yy,y, m, d, h, mi, s, strDateTime
      FormatDate = DateAndTime
      If Not IsNumeric(Format) Then Exit Function
      If Not IsDate(DateAndTime) Then Exit Function
      yy = CStr(Year(DateAndTime))
      y = Mid(CStr(Year(DateAndTime)),3)
      m = CStr(Month(DateAndTime))
      If Len(m) = 1 Then m = "0" & m
      d = CStr(Day(DateAndTime))
      If Len(d) = 1 Then d = "0" & d
      h = CStr(Hour(DateAndTime))
      If Len(h) = 1 Then h = "0" & h
      mi = CStr(Minute(DateAndTime))
      If Len(mi) = 1 Then mi = "0" & mi
      s = CStr(Second(DateAndTime))
      If Len(s) = 1 Then s = "0" & s
      Select Case Format
      Case "1"
        strDateTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s
      Case "2"
        strDateTime = yy & m & d & h & mi & s
      Case "3"
        strDateTime = yy & m & d & h & mi
      Case "4"
        strDateTime = yy & "" & m & "" & d & ""
      Case "5"
        strDateTime = m & "-" & d
      Case "6"
        strDateTime = m & "/" & d
      Case "7"
        strDateTime = m & "" & d & ""
      Case "8"
        strDateTime = y & "" & m & ""
      Case "9"
        strDateTime = y & "-" & m
      Case "10"
        strDateTime = y & "/" & m
      Case "11"
        strDateTime = y & "-" & m & "-" & d
      Case "12"
        strDateTime = y & "/" & m & "/" & d
      Case "13"
        strDateTime = yy & "." & m & "." & d
      Case "14"
        strDateTime = yy & "-" & m & "-" & d
      Case Else
        strDateTime = DateAndTime
      End Select
      FormatDate = strDateTime
    End Function
  • 相关阅读:
    python下multiprocessing和gevent的组合使用
    TCP的三次握手与四次挥手理解及面试题(很全面)
    Python设计模式
    python定义接口继承类
    pycharm 中自动补全代码提示前符号 p,m ,c,v, f 是什么意思
    21天打造分布式爬虫-urllib库(一)
    redis的使用
    Memcached的使用
    12.Flask-Restful
    11.Flask钩子函数
  • 原文地址:https://www.cnblogs.com/liuswi/p/2754619.html
Copyright © 2011-2022 走看看