ludic/ns-datetime.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
3.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DateTime — Ludic</title>
<meta name="description" content="Instants on the wall-clock timeline (UTC), stored as a plain int: the count of seconds since 1970-01-01, matching Time.now.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">DateTime</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">DateTime</h1></div>
<p class="ns-blurb">Instants on the wall-clock timeline (UTC), stored as a plain <code>int</code>: the count of seconds since 1970-01-01, matching <code>Time.now</code>. Build one with <code>DateTime.from</code>, shift it by a <code>Duration</code> with <code>DateTime.add</code>, and pull it apart with the <code>year</code>/<code>month</code>/<code>day</code>/<code>hour</code>/<code>minute</code>/<code>second</code> readers. Deterministic integer math throughout; v1 is UTC-only with no leap seconds, and assumes instants at or after 1970.</p>
<div class="ns-methods"><a class="ns-method" href="datetime-from.html"><code class="nm-sig">DateTime.from(year, month, day, hour, minute, second) -&gt; int</code><span class="nm-tip">Build an instant from its calendar parts.</span></a><a class="ns-method" href="datetime-date.html"><code class="nm-sig">DateTime.date(dt) -&gt; int</code><span class="nm-tip">The calendar day the instant falls on.</span></a><a class="ns-method" href="datetime-add.html"><code class="nm-sig">DateTime.add(dt, span) -&gt; int</code><span class="nm-tip">The instant `span` seconds later.</span></a><a class="ns-method" href="datetime-year.html"><code class="nm-sig">DateTime.year(dt) -&gt; int</code><span class="nm-tip">The calendar year of an instant.</span></a><a class="ns-method" href="datetime-month.html"><code class="nm-sig">DateTime.month(dt) -&gt; int</code><span class="nm-tip">The month (1-12) of an instant.</span></a><a class="ns-method" href="datetime-day.html"><code class="nm-sig">DateTime.day(dt) -&gt; int</code><span class="nm-tip">The day of the month (1-31) of an instant.</span></a><a class="ns-method" href="datetime-weekday.html"><code class="nm-sig">DateTime.weekday(dt) -&gt; int</code><span class="nm-tip">Day of the week, 0=Sunday..6=Saturday.</span></a><a class="ns-method" href="datetime-hour.html"><code class="nm-sig">DateTime.hour(dt) -&gt; int</code><span class="nm-tip">The hour of day (0-23) of an instant.</span></a><a class="ns-method" href="datetime-minute.html"><code class="nm-sig">DateTime.minute(dt) -&gt; int</code><span class="nm-tip">The minute of the hour (0-59) of an instant.</span></a><a class="ns-method" href="datetime-second.html"><code class="nm-sig">DateTime.second(dt) -&gt; int</code><span class="nm-tip">The second of the minute (0-59) of an instant.</span></a><a class="ns-method" href="datetime-format.html"><code class="nm-sig">DateTime.format(dt, pattern) -&gt; string</code><span class="nm-tip">Render an instant as text using a token pattern.</span></a><a class="ns-method" href="datetime-parse.html"><code class="nm-sig">DateTime.parse(text, pattern) -&gt; int</code><span class="nm-tip">Parse text into an instant; -1 on failure.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>