+ -
当前位置:首页 → 问答吧 → VB 6.0时分秒定义比较

VB 6.0时分秒定义比较

时间:2011-08-12

来源:互联网

获取当前时间 Command5.Caption = Time
我想知道现在是 上午还是下午 
if 条件怎么写 then
  上午
else if 条件怎么写 then 
  下午
Endif

作者: ni04730184   发布时间: 2011-08-12

VB code

Private Sub Command1_Click()
  Command5.Caption = Time
  If InStr(Format(Command5.Caption, "Medium Time"), "上午") Then
    MsgBox "上午"
  Else
    MsgBox "下午"
  End If
End Sub


作者: chinaboyzyq   发布时间: 2011-08-12

如果是英文系统,恐怕就不好使了

作者: mokton   发布时间: 2011-08-12

Private Sub Command1_Click()
  Command1.Caption = Time
  If Val(Format(Command1.Caption, "HH")) < 12 Then
  MsgBox "上午"
  Else
  MsgBox "下午"
  End If
End Sub

作者: mokton   发布时间: 2011-08-12

热门下载

更多