How does js get the timestamp from the beginning of a certain month of a year?

how does js get the timestamp of the beginning of a certain month in a certain year? Php can be realized by mktime. I wonder if there is any easy way to get js.
what I need here is to get the data of a month. First, I need to pass the start and end timestamps of a month, and the backend will judge by this.

Mar.06,2021

it's best to use monent.js

for complex time.
let t = Date.now() - new Date('2018-4-27 10:57:00').getTime()

the old brand usually uses moment.js . However, the Nuggets recently returned a dayjs , which seems to be good.


function computeTime(year, month){
    return [
        new Date(year, month - 1, 1).getTime(),
        new Date(year, month, 0).getTime()
    ]
}
computeTime(2017, 2)

get the time to turn the timestamp

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cf0e-2b6b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cf0e-2b6b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?