📄 datetime.asp
字号:
<%
Dim rsDateTimeFormat
Dim saryDateTimeData(17)
Dim intLoopCounter
Set rsDateTimeFormat = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT timesdtm.* FROM timesdtm;"
rsDateTimeFormat.Open strSQL, adoCon
If NOT rsDateTimeFormat.EOF Then
If strDateFormat <> "" Then
saryDateTimeData(0) = strDateFormat
Else
saryDateTimeData(0) = rsDateTimeFormat("dtfmt")
End If
saryDateTimeData(1) = rsDateTimeFormat("yearfmt")
saryDateTimeData(2) = rsDateTimeFormat("Seporator")
For intLoopCounter = 1 to 12
saryDateTimeData((intLoopCounter + 2)) = rsDateTimeFormat("Month" & (intLoopCounter))
Next
saryDateTimeData(15) = rsDateTimeFormat("tmfmt")
saryDateTimeData(16) = rsDateTimeFormat("am")
saryDateTimeData(17) = rsDateTimeFormat("pm")
End If
rsDateTimeFormat.Close
Set rsDateTimeFormat = Nothing
Private Function DateFormat(ByVal dtmDate, ByVal saryDateTimeData)
Dim strNewDate
Dim intDay
Dim intMonth
Dim strMonth
Dim intYear
Dim dtmTempDate
If isNull(saryDateTimeData) Then
DateFormat = dtmDate
Else
If strTimeOffSet = "+" Then
dtmTempDate = DateAdd("h", + intTimeOffSet, dtmDate)
ElseIf strTimeOffSet = "-" Then
dtmTempDate = DateAdd("h", - intTimeOffSet, dtmDate)
End If
intDay = CInt(Day(dtmTempDate))
intMonth = CInt(Month(dtmTempDate))
intYear = CInt(Year(dtmTempDate))
If intDay < 10 then intDay = "0" & intDay
If saryDateTimeData(1) = "short" Then intYear = Right(intYear, 2)
strMonth = saryDateTimeData((intMonth + 2))
Select Case saryDateTimeData(0)
Case "dd/mm/yy"
DateFormat = intDay & saryDateTimeData(2) & strMonth & saryDateTimeData(2) & intYear
Case "mm/dd/yy"
DateFormat = strMonth & saryDateTimeData(2) & intDay & saryDateTimeData(2) & intYear
Case "yy/dd/mm"
DateFormat = intYear & saryDateTimeData(2) & intDay & saryDateTimeData(2) & strMonth
Case "yy/mm/dd"
DateFormat = intYear & saryDateTimeData(2) & strMonth & saryDateTimeData(2) & intDay
End Select
End If
End Function
Function TimeFormat(ByVal dtmTime, ByVal saryDateTimeData)
Dim strNewDate
Dim intHour
Dim intMinute
Dim strPeriod
Dim dtmTempTime
If isNull(saryDateTimeData) Then
TimeFormat = dtmTime
Else
If strTimeOffSet = "+" Then
dtmTempTime = DateAdd("h", + intTimeOffSet, dtmTime)
ElseIf strTimeOffSet = "-" Then
dtmTempTime = DateAdd("h", - intTimeOffSet, dtmTime)
End If
intHour = CInt(Hour(dtmTempTime))
intMinute = CInt(Minute(dtmTempTime))
If intMinute < 10 then intMinute = "0" & intMinute
If CInt(saryDateTimeData(15)) = 12 Then
If intHour >= 12 then
strPeriod = saryDateTimeData(17)
Else
strPeriod = saryDateTimeData(16)
End If
Select Case intHour
Case 00
intHour = 12
Case 01
intHour = 1
Case 02
intHour = 2
Case 03
intHour = 3
Case 04
intHour = 4
Case 05
intHour = 5
Case 06
intHour = 6
Case 07
intHour = 7
Case 08
intHour = 8
Case 09
intHour = 9
Case 13
intHour = 1
Case 14
intHour = 2
Case 15
intHour = 3
Case 16
intHour = 4
Case 17
intHour = 5
Case 18
intHour = 6
Case 19
intHour = 7
Case 20
intHour = 8
Case 21
intHour = 9
Case 22
intHour = 10
Case 23
intHour = 11
End Select
ElseIf intHour < 10 Then
intHour = "0" & intHour
End If
TimeFormat = intHour & ":" & intMinute & strPeriod
End If
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -