#time Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Kotlin kotlin.time — Duration and measureTime
`kotlin.time.Duration` is a typesafe time amount with friendly literal syntax (`5.seconds`, `2.minutes`). `measureTime { }` benchmarks a block.
Go time.Ticker — Periodic Tasks
`time.NewTicker(d)` fires on a channel every `d` interval. Combine with select + a done channel for a clean way to run periodic work that can be cancelled.
Java java.time — Format and Parse
`DateTimeFormatter` replaces `SimpleDateFormat` (which was not thread-safe). Constants for the common formats; pattern strings for custom layouts.
Go time.Since — Easy Benchmark Timing
`time.Since(start)` is shorthand for `time.Now().Sub(start)`. Pair with `defer` for a quick "how long did this function take?" measurement.
HTML Time Element with datetime Attribute
`<time datetime="...">` lets you display a human-friendly date while giving machines an ISO-8601 timestamp. Used by browsers, Schema.org parsers, and screen readers.
Go time.Format — The Reference Time
Go's time formatting uses a reference date instead of strftime tokens: `Mon Jan 2 15:04:05 MST 2006` (which is 01/02 03:04:05PM '06 -0700, or 1/2/3/4/5/6/7 — mnemonic). Strange at first, instantly memorable.
Java java.time — Duration and Period
`Duration` for elapsed time (hours/minutes/seconds). `Period` for calendar amounts (days/months/years). Don't mix — calendar math respects month lengths and DST; clock math doesn't.
Java java.time — Instant, LocalDate, ZonedDateTime
Java 8's `java.time` package replaced the broken `Date`/`Calendar`. Three types you actually use: `Instant` (UTC moment), `LocalDate` (date with no tz), `ZonedDateTime` (date+time in a zone).