VB get system time

Required function:

Now function: returns the current date and time of the system

Format function: Formats data according to a format expression

Main points:

yyyy (year): represents the year

MM (month): represents the month

dd (day): represents the date

hh (hour): 12-hour clock

HH (Hour): 24-hour clock

mm (minute): minutes

ss (second): second

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = Format(Now, "今天是yyyy年MM月dd日")
        Label2.Text = Format(Now, "现在是HH点mm分ss秒")
    End Sub

Note: To set in the timer, ensure the refresh rate to ensure the timeliness of the time 

 

Guess you like

Origin blog.csdn.net/sinat_56238820/article/details/123424946