📄 ctime1.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "CTime1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Fig. 16.2
' Class definition for CTime1
Option Explicit
Private mHour As Integer
Private mMinute As Integer
Private mSecond As Integer
Public Sub SetTime(ByVal h As Integer, ByVal m As Integer, _
ByVal s As Integer)
mHour = IIf((h >= 0 And h < 24), h, 0)
mMinute = IIf((m >= 0 And m < 60), m, 0)
mSecond = IIf((s >= 0 And s < 60), s, 0)
End Sub
Public Function ToUniversalTime() As String
ToUniversalTime = Format$(mHour, "00") & ":" & _
Format$(mMinute, "00") & ":" & _
Format$(mSecond, "00")
End Function
Public Function ToStandardTime() As String
Dim h As Integer
h = IIf((mHour = 12 Or mHour = 0), 12, mHour Mod 12)
ToStandardTime = h & ":" & _
Format$(mMinute, "00") & ":" & _
Format$(mSecond, "00") & " " & _
IIf(mHour < 12, "AM", "PM")
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -