Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6061881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:59:16+00:00 2026-05-23T08:59:16+00:00

How can I create a UUID from the Timestamp number using Javascript? Is there

  • 0

How can I create a UUID from the Timestamp number using Javascript?

Is there any existente API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:59:16+00:00Added an answer on May 23, 2026 at 8:59 am

    According to the Wikipedia page, a UUID is a 128-bit number. Javascript numbers are 64-bit floating point numbers (according to this SO answer), so I assume that you already have your UUID number in the form of a string.

    Quoting Wikipedia: “a UUID consists of 32 hexadecimal digits, displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 digits and 4 hyphens).” Javascript Number‘s toString method can be given a base (hexadecimal is base 16) but of course we can’t use Numbers here.

    So, you’ll need some sort of code that can first handle 128-bit numbers and then convert them to hexadecimal. There are various BigDecimal and BigNumber Javascript libraries knocking about. Just find one that you like, perhaps using a SO question as a guide. Having done that you’ll have a string like so:

    var hexNum = "550e8400e29b41d4a716446655440000";
    

    Then you simple combine the different substrings with - separators and you have your UUID string:

    var UUID = hexNum.substr(0, 8) + '-' +  hexNum.substr(8, 4) + '-' + 
      hexNum.substr(12, 4) + '-' + hexNum.substr(16, 4) + '-' + hexNum.substr(20)
    

    Update: In the process of writing my response the original question was updated to ask how you’d create a UUID from a ‘Timestamp number’. I’m not sure what that’d be, perhaps a Unix timestamp, for instance the result of Date.now(). Since UUIDs are supposed to be (practically) unique and a millisecond time is hardly unique, I’d imagine you’d want to introduce some further element of uniqueness into the number before creating the number. Even if you didn’t, you’d still need to convert 64-bit Number to a 128-bit number, again using some sort of BigDecimal or BigNumber library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You can create new objects, but when you've finished using them there's no real
I understand that you can create a random number via javascript with: Math.floor(Math.random()*100); the
I can create the following and reference it using area[0].states[0] area[0].cities[0] var area =
Is there anyway I can create a not in clause like I would have
Is there a website I can create an HTML final four bracket? Or is
Is there a way I can create Windows firewall exceptions in VB2005? I'm trying
Possible Duplicate: How to create a GUID / UUID in Javascript? I need to
can anyone tell me if we can create a video player purely in javascript?
Any ideas on how i can create this app? 1) i have a page
I have seen that in Cocoa I can create a custom view using drawing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.