/ jQuery

Previous Article

PHP Time() Equivalent for Javascript

Next Article

This function utilises the Date object. When the Date.getTime() object instance is created it calls the number of seconds since 1 January 1970 UTC. As we only want the number of seconds (not milliseconds) we divide the result by 1000.

The Math.floor part rounds the number down to the nearest whole number.

function time() {
    var timestamp = Math.floor(new Date().getTime() / 1000)
    return timestamp;
}
Avatar of Clive Walkden

Clive Walkden

Latest Articles

Linux

Output All Users Cron Jobs

If you want to check all users cron jobs this little command will output them to the command line

Magento 2

Magento 2 admin password history reset

Do you want to clear the password history on your staging test site (not recommended for live)?

Linux

How to see files changed on a certain date

As a sysadmin you often need to see which files have been modified on a certain date.