top of page

Create random number with Unix Time Stamp Epoch Code


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 () {

function unixCode() {
 var timeStamp = Math.floor( / 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



by Code Queen

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.

Online Booking: Discovery Session

Contact Form: Send project details

285 views0 comments



a quick note about our website content

Our free and premium content is non-exclusive, meaning you are not the only one with access to the content. You can customize our content to fit your end product. Redistribution of our content is strictly prohibited. This means you cannot make our content available to others as-is, stand-alone products or stock products in ANY LANGUAGE, regardless if you offer our content for free or not.

bottom of page