René's URL Explorer Experiment
Title: Instant with nanosecond precision | java.evolved
Open Graph Title: Instant with nanosecond precision | java.evolved
X Title: Instant with nanosecond precision | java.evolved
Description: Get timestamps with microsecond or nanosecond precision.
Open Graph Description: Get timestamps with microsecond or nanosecond precision.
X Description: Get timestamps with microsecond or nanosecond precision.
Opengraph URL: https://javaevolved.github.io/datetime/instant-precision.html
direct link
Domain: javaevolved.github.io
Hey, it has json ld scripts:
{
"@context": "https://schema.org",
"@type": "TechArticle",
"headline": "Instant with nanosecond precision",
"description": "Get timestamps with microsecond or nanosecond precision.",
"url": "https://javaevolved.github.io/instant-precision.html",
"publisher": {
"@type": "Organization",
"name": "java.evolved",
"url": "https://javaevolved.github.io"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://javaevolved.github.io/instant-precision.html"
}
}
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://javaevolved.github.io/"
},
{
"@type": "ListItem",
"position": 2,
"name": "Date/Time",
"item": "https://javaevolved.github.io/#datetime"
},
{
"@type": "ListItem",
"position": 3,
"name": "Instant with nanosecond precision"
}
]
}
| theme-color | #f97316 |
| mobile-web-app-capable | yes |
| apple-mobile-web-app-status-bar-style | black-translucent |
| apple-mobile-web-app-title | java.evolved |
| og:type | article |
| og:site_name | java.evolved |
| og:locale | en |
| og:image | https://javaevolved.github.io/og/datetime/instant-precision.png |
| og:image:width | 1200 |
| og:image:height | 630 |
| og:image:type | image/png |
| twitter:card | summary_large_image |
| twitter:image | https://javaevolved.github.io/og/datetime/instant-precision.png |
Links:
| java.evolved | https://javaevolved.github.io/ |
|
| https://github.com/javaevolved/javaevolved.github.io |
| ← All patterns | https://javaevolved.github.io/ |
| ← | https://javaevolved.github.io/datetime/date-formatting.html |
| → | https://javaevolved.github.io/datetime/math-clamp.html |
| Home | https://javaevolved.github.io/ |
| Date/Time | https://javaevolved.github.io/#datetime |
| 🐛 Report a code issue | https://github.com/javaevolved/javaevolved.github.io/issues/new?template=code-issue.yml&title=%5BCode%20Issue%5D%20Instant%20with%20nanosecond%20precision&category=datetime&slug=instant-precision |
| 🌐 Report a translation issue | https://github.com/javaevolved/javaevolved.github.io/issues/new?template=translation-issue.yml&title=%5BTranslation%5D%20Instant%20with%20nanosecond%20precision%20%28English%29&locale=en&pattern=instant-precision&area=Pattern%20content |
| 💡 Suggest a new pattern | https://github.com/javaevolved/javaevolved.github.io/issues/new?template=new-pattern.yml |
| 𝕏 | https://x.com/intent/tweet?url=https%3A%2F%2Fjavaevolved.github.io%2Fdatetime%2Finstant-precision.html&text=Instant%20with%20nanosecond%20precision%20%E2%80%93%20java.evolved |
| 🦋 | https://bsky.app/intent/compose?text=Instant%20with%20nanosecond%20precision%20%E2%80%93%20java.evolved%20https%3A%2F%2Fjavaevolved.github.io%2Fdatetime%2Finstant-precision.html |
| in | https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fjavaevolved.github.io%2Fdatetime%2Finstant-precision.html |
| ⬡ | https://www.reddit.com/submit?url=https%3A%2F%2Fjavaevolved.github.io%2Fdatetime%2Finstant-precision.html&title=Instant%20with%20nanosecond%20precision%20%E2%80%93%20java.evolved |
| Let us know. | https://github.com/javaevolved/javaevolved.github.io/issues/new?template=code-issue.yml&title=%5BCode%20Issue%5D%20Instant%20with%20nanosecond%20precision&category=datetime&slug=instant-precision |
| Instant ↗ | https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/time/Instant.html |
| Clock ↗ | https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/time/Clock.html |
| View proof source ↗ | https://github.com/javaevolved/javaevolved.github.io/blob/main/proof/datetime/InstantPrecision.java |
|
Date/Time
Intermediate
HexFormat
Java 8
// Pad to 2 digits, uppercase
String hex = String.format(
"%02X", byteValue);
// Parse hex string
int val = Integer.parseInt(
"FF", 16);
Java 17+
var hex = HexFormat.of()
.withUpperCase();
String s = hex.toHexDigits(
byteValue);
byte[] bytes =
hex.parseHex("48656C6C6F");
Hover to see modern ➜
JDK 17+
→
| https://javaevolved.github.io/datetime/hex-format.html |
|
Date/Time
Beginner
java.time API basics
Pre-Java 8
// Mutable, confusing, zero-indexed months
Calendar cal = Calendar.getInstance();
cal.set(2025, 0, 15); // January = 0!
Date date = cal.getTime();
// not thread-safe
Java 8+
LocalDate date = LocalDate.of(
2025, Month.JANUARY, 15);
LocalTime time = LocalTime.of(14, 30);
Instant now = Instant.now();
// immutable, thread-safe
Hover to see modern ➜
JDK 8+
→
| https://javaevolved.github.io/datetime/java-time-basics.html |
|
Date/Time
Beginner
Duration and Period
Pre-Java 8
// How many days between two dates?
long diff = date2.getTime()
- date1.getTime();
long days = diff
/ (1000 * 60 * 60 * 24);
// ignores DST, leap seconds
Java 8+
long days = ChronoUnit.DAYS
.between(date1, date2);
Period period = Period.between(
date1, date2);
Duration elapsed = Duration.between(
time1, time2);
Hover to see modern ➜
JDK 8+
→
| https://javaevolved.github.io/datetime/duration-and-period.html |
| java.evolved | https://javaevolved.github.io/ |
| Bruno Borges | https://github.com/brunoborges |
| GitHub Copilot | https://github.com/features/copilot |
| modern-css.com | https://modern-css.com |
| View on GitHub | https://github.com/javaevolved/javaevolved.github.io |
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow
URLs of crawlers that visited me.