Skip to main content

Provide extension methods to round trip between NodaTime Instant and sequential guid

Total Downloads
27.7K
27,726
Published
Jun 10, 2026
5mo ago

Get Started

dotnet add package SequentialGuid.NodaTime --version 6.2.0
ProductVersions
.NET
net10.0net11.0net8.0net9.0
.NET Standard
netstandard2.0
Other
.NETFramework4.6.2

README

SequentialGuid.NodaTime

NuGet NuGet Downloads

NodaTime integration for the SequentialGuid library. Generate sequential UUIDs from NodaTime Instant, OffsetDateTime, and ZonedDateTime values, and extract embedded timestamps as Instant.

Install

dotnet add package SequentialGuid.NodaTime

Requires NodaTime 2.4.0 or later.

Features

Feature Description
GuidV7.NewGuid(instant) Generate a UUIDv7 from an Instant, OffsetDateTime, or ZonedDateTime
GuidV7.NewSqlGuid(instant) Same as above but with SQL Server byte ordering
GuidV8Time.NewGuid(instant) Generate a UUIDv8 from an Instant, OffsetDateTime, or ZonedDateTime
GuidV8Time.NewSqlGuid(instant) Same as above but with SQL Server byte ordering
guid.ToInstant() Extract the embedded timestamp as a NodaTime Instant

Quick Start

Generate UUIDs from NodaTime types

using NodaTime;
using SequentialGuid;

var now = SystemClock.Instance.GetCurrentInstant();

// UUIDv7 (millisecond precision) - recommended for most applications
var id = GuidV7.NewGuid(now);

// UUIDv8 (tick precision)
var id = GuidV8Time.NewGuid(now);

// SQL Server byte order variants
var sqlId = GuidV7.NewSqlGuid(now);
var sqlId = GuidV8Time.NewSqlGuid(now);

Generate from OffsetDateTime or ZonedDateTime

var offsetDt = new OffsetDateTime(
    new LocalDateTime(2025, 7, 1, 12, 0, 0),
    Offset.FromHours(-5));
var id = GuidV7.NewGuid(offsetDt);

var zonedDt = offsetDt.InZone(DateTimeZoneProviders.Tzdb["America/New_York"]);
var id = GuidV7.NewGuid(zonedDt);

Extract a timestamp as Instant

using NodaTime;

Guid id = GuidV7.NewGuid();
Instant? created = id.ToInstant();
// Returns the embedded UTC timestamp as an Instant, or null if not a sequential GUID

Supported Timestamp Types

All generation methods accept these NodaTime types:

Type Notes
Instant Directly converted; most common usage
OffsetDateTime Converted to Instant (for V8) or DateTimeOffset (for V7)
ZonedDateTime Converted to Instant (for V8) or DateTimeOffset (for V7)

Further Reading

See the main SequentialGuid README for full documentation on UUID generation, timestamp extraction, and SQL Server byte-order handling.

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 6 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.