我这里有一个工作代码,但输出是 24 小时格式:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = Now.TimeOfDay.ToString()
End Sub
我使用了一个计时器,但我的输出如下所示:
17:00:30.123456
我希望我的输出是这样的 12 小时格式:
5:00 PM