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

解决方案 »

  1.   


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

  2.   

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

  3.   


    Private Sub Command1_Click()
      dim d as date
      d=Time  
      Command5.Caption = cstr(d)  If hour(d) < 12 Then
      MsgBox "上午"
      Else
      MsgBox "下午"
      End If
    End Sub
      

  4.   

    mokton 这种方法比较好的,支持
      

  5.   


      MsgBox Left(Format(Time, "Medium Time"), 2)
      

  6.   

        If Format(Time, "HH") < 12 Then
            MsgBox "上午"
        Else
            MsgBox "下午"
        End If