Provide extension methods to round trip between NodaTime Instant and sequential guid
Get Started
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
SequentialGuid.NodaTime
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
NodaTime2.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.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.