/ jQuery
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;
}

Clive Walkden
Latest Articles

Linux —
Terraform InstallationA quick installation guide for Terraform on Ubuntu 18.04

Clive Walkden
Author

Bitcoin —
RollerCoin IntroAn introduction to the RollerCoin site and how you can use it to mine your own coins

Clive Walkden
Author

Magento 2.4.x Writing to a Log File
How to log to information to a file in different Magento 2.4.x versions

Clive Walkden
Author