ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules types TimeUuid

TimeUuid¶

types~TimeUuid(dateopt, ticksopt, nodeIdopt, clockIdopt)

Represents an immutable version 1 universally unique identifier (UUID). A UUID represents a 128-bit value.

Constructor¶

new TimeUuid(dateopt, ticksopt, nodeIdopt, clockIdopt)

Creates a new instance of Uuid based on the parameters provided according to rfc4122. If any of the arguments is not provided, it will be randomly generated, except for the date that will use the current date.

If nodeId and/or clockId portions are not provided, the constructor will generate them using crypto.randomBytes(). As it's possible that crypto.randomBytes() might block, it's recommended that you use the callback-based version of the static methods fromDate() or now()in that case.

Parameters:
Name Type Attributes Description
date Date <optional>

The date for the instance. If not provided, current Date will be used.

ticks number <optional>

A number from 0 to 10000 representing the 100-nanoseconds units for this instance to fill in the information not available in the Date, as Ecmascript Dates have only milliseconds precision.

nodeId string | Buffer <optional>

A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'.

clockId string | Buffer <optional>

A 2-length Buffer or string of 6 ascii characters representing the clock identifier.

Source

types/time-uuid.js, line 51

Extends¶

  • module:types~Uuid

Methods¶

getClockId() → {Buffer}

Returns the clock id this instance, with the variant applied (first 2 msb being 1 and 0).

Source

types/time-uuid.js, line 253

Returns:
Type
Buffer

getDate() → {Date}

Gets the Date representation of this instance.

Source

types/time-uuid.js, line 237

Returns:
Type
Date

getDatePrecision() → {Object}

Gets the Date and 100-nanoseconds units representation of this instance.

Source

types/time-uuid.js, line 215

Returns:
Type
Object

getNodeId() → {Buffer}

Returns the node id this instance

Source

types/time-uuid.js, line 245

Returns:
Type
Buffer

getNodeIdString() → {string}

Returns the node id this instance as an ascii string

Source

types/time-uuid.js, line 261

Returns:
Type
string

(static) fromDate(date, ticksopt, nodeIdopt, clockIdopt, callbackopt)

Generates a TimeUuid instance based on the Date provided using random node and clock values.

Parameters:
Name Type Attributes Description
date Date

Date to generate the v1 uuid.

ticks number <optional>

A number from 0 to 10000 representing the 100-nanoseconds units for this instance to fill in the information not available in the Date, as Ecmascript Dates have only milliseconds precision.

nodeId string | Buffer <optional>

A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'. If not provided, a random nodeId will be generated.

clockId string | Buffer <optional>

A 2-length Buffer or string of 6 ascii characters representing the clock identifier. If not provided a random clockId will be generated.

callback function <optional>

An optional callback to be invoked with the error as first parameter and the created TimeUuid as second parameter. When a callback is provided, the random portions of the TimeUuid instance are created asynchronously.

When nodeId and/or clockId portions are not provided, this method will generate them using crypto.randomBytes(). As it's possible that crypto.randomBytes() might block, it's recommended that you use the callback-based version of this method in that case.

Source

types/time-uuid.js, line 111

Examples

Generate a TimeUuid from a ECMAScript Date

const timeuuid = TimeUuid.fromDate(new Date());

Generate a TimeUuid from a Date with ticks portion

const timeuuid = TimeUuid.fromDate(new Date(), 1203);

Generate a TimeUuid from a Date without any random portion

const timeuuid = TimeUuid.fromDate(new Date(), 1203, 'host01', '02');

Generate a TimeUuid from a Date with random node and clock identifiers

TimeUuid.fromDate(new Date(), 1203, function (err, timeuuid) {
  // do something with the generated timeuuid
});

(package, static) fromRust(buffer) → {TimeUuid}

Parameters:
Name Type Description
buffer Buffer

Source

types/time-uuid.js, line 270

Returns:
Type
TimeUuid

(static) fromString(value) → {TimeUuid}

Parses a string representation of a TimeUuid

Parameters:
Name Type Description
value string

should be in 00000000-0000-0000-0000-000000000000 format

Source

types/time-uuid.js, line 160

Returns:
Type
TimeUuid

(static) max(date, ticks) → {TimeUuid}

Returns the biggest possible type 1 uuid with the provided Date.

Parameters:
Name Type Description
date Date
ticks number

Source

types/time-uuid.js, line 180

Returns:
Type
TimeUuid

(static) min(date, ticks) → {TimeUuid}

Returns the smallest possible type 1 uuid with the provided Date.

Parameters:
Name Type Description
date Date
ticks number

Source

types/time-uuid.js, line 170

Returns:
Type
TimeUuid

(static) now(nodeIdopt, clockIdopt, callbackopt)

Generates a TimeUuid instance based on the current date using random node and clock values.

Parameters:
Name Type Attributes Description
nodeId string | Buffer <optional>

A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'. If not provided, a random nodeId will be generated.

clockId string | Buffer <optional>

A 2-length Buffer or string of 6 ascii characters representing the clock identifier. If not provided a random clockId will be generated.

callback function <optional>

An optional callback to be invoked with the error as first parameter and the created TimeUuid as second parameter. When a callback is provided, the random portions of the TimeUuid instance are created asynchronously.

When nodeId and/or clockId portions are not provided, this method will generate them using crypto.randomBytes(). As it's possible that crypto.randomBytes() might block, it's recommended that you use the callback-based version of this method in that case.

Source

types/time-uuid.js, line 207

Examples

Generate a TimeUuid from a Date without any random portion

const timeuuid = TimeUuid.now('host01', '02');

Generate a TimeUuid with random node and clock identifiers

TimeUuid.now(function (err, timeuuid) {
  // do something with the generated timeuuid
});

Generate a TimeUuid based on the current date (might block)

const timeuuid = TimeUuid.now();

Was this page helpful?

PREVIOUS
Row
NEXT
Vector
  • Create an issue
  • Edit this page

On this page

  • TimeUuid
    • Constructor
    • Extends
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • main
    • main
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Point
      • Polygon
      • PreparedInfo
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 May 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2