Uncategorized

Create random number with Unix Time Stamp Epoch Code

About The following code takes todays date and time and converts it to a 10 digit number.  This is a fast and easy way to create a random...

About

The following code takes todays date and time and converts it to a 10 digit number.  This is a fast and easy way to create a random number.   Note that this method does not guarantee that duplicates will be avoided because it depends on your logic use for this code.

Good to Know #1

The Code

$w.onReady(function () {
    unixCode();
});function unixCode() {
 var timeStamp = Math.floor(Date.now() / 1000);
    $w('#yourElement').value = timeStamp.toString();}// Change the name of #yourElement to the element ID name on your page.  If your element is a user input element set the ending to read .value if the element is a text element set the ending to be .text

Author

by Code Queen

Corvid , Wix Design, Project Planning, Private Tutoring

Services world wide

Stuck on a project? Hire Code Queen, LLC!

Schedule a phone call or video call directly online. In a different time zone? No problem! Code Queen currently has clients around the world.

Share this post

Loading...