js tips (2)

1, date object (date object)

        Get the current time
        using method, var date= new Date() //return the current time

         Get the current year 

         Get the current month

         get current date

           Get the current day of the week

         Get the current hour, minute, and second

        date.getHous() gets the current hour and returns 0-23, because it starts from 0, so it gets +1
         date.getMinutes() gets the current minute and returns 0-59, because it starts from 0 Start, so get +1
        date.getSeconde() to get the current number of seconds, and return 0-59 because it starts from 0, so get +1
        date.getMilliseconds() returns the current milliseconds, and returns 0-999, because it starts from 0, so it gets +1

            

Guess you like

Origin blog.csdn.net/m0_58002043/article/details/129519990