1
0
Fork 0
cl-sites/guile.html_node/SRFI_002d19-Date.html

176 lines
11 KiB
HTML
Raw Normal View History

2024-12-17 12:49:28 +01:00
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual documents Guile version 3.0.10.
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
Inc.
Copyright (C) 2021 Maxime Devos
Copyright (C) 2024 Tomas Volf
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License." -->
<title>SRFI-19 Date (Guile Reference Manual)</title>
<meta name="description" content="SRFI-19 Date (Guile Reference Manual)">
<meta name="keywords" content="SRFI-19 Date (Guile Reference Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content=".texi2any-real">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="SRFI_002d19.html" rel="up" title="SRFI-19">
<link href="SRFI_002d19-Time_002fDate-conversions.html" rel="next" title="SRFI-19 Time/Date conversions">
<link href="SRFI_002d19-Time.html" rel="prev" title="SRFI-19 Time">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
</head>
<body lang="en">
<div class="subsubsection-level-extent" id="SRFI_002d19-Date">
<div class="nav-panel">
<p>
Next: <a href="SRFI_002d19-Time_002fDate-conversions.html" accesskey="n" rel="next">SRFI-19 Time/Date conversions</a>, Previous: <a href="SRFI_002d19-Time.html" accesskey="p" rel="prev">SRFI-19 Time</a>, Up: <a href="SRFI_002d19.html" accesskey="u" rel="up">SRFI-19 - Time/Date Library</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsubsection" id="SRFI_002d19-Date-1"><span>7.5.16.3 SRFI-19 Date<a class="copiable-link" href="#SRFI_002d19-Date-1"> &para;</a></span></h4>
<a class="index-entry-id" id="index-date-1"></a>
<p>A <em class="dfn">date</em> object represents a date in the Gregorian calendar and a
time of day on that date in some timezone.
</p>
<p>The fields are year, month, day, hour, minute, second, nanoseconds and
timezone. A date object is immutable, its fields can be read but they
cannot be modified once the object is created.
</p>
<p>Historically, the Gregorian calendar was only used from the latter part
of the year 1582 onwards, and not until even later in many countries.
Prior to that most countries used the Julian calendar. SRFI-19 does
not deal with the Julian calendar at all, and so does not reflect this
historical calendar reform. Instead it projects the Gregorian calendar
back proleptically as far as necessary. When dealing with historical
data, especially prior to the British Empire&rsquo;s adoption of the Gregorian
calendar in 1752, one should be mindful of which calendar is used in
each context, and apply non-SRFI-19 facilities to convert where necessary.
</p>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_003f"><span class="category-def">Function: </span><span><strong class="def-name">date?</strong> <var class="def-var-arguments">obj</var><a class="copiable-link" href="#index-date_003f"> &para;</a></span></dt>
<dd><p>Return <code class="code">#t</code> if <var class="var">obj</var> is a date object, or <code class="code">#f</code> if not.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-make_002ddate"><span class="category-def">Function: </span><span><strong class="def-name">make-date</strong> <var class="def-var-arguments">nsecs seconds minutes hours date month year zone-offset</var><a class="copiable-link" href="#index-make_002ddate"> &para;</a></span></dt>
<dd><p>Create a new date object.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dnanosecond"><span class="category-def">Function: </span><span><strong class="def-name">date-nanosecond</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dnanosecond"> &para;</a></span></dt>
<dd><p>Nanoseconds, 0 to 999999999.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dsecond"><span class="category-def">Function: </span><span><strong class="def-name">date-second</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dsecond"> &para;</a></span></dt>
<dd><p>Seconds, 0 to 59, or 60 for a leap second. 60 is never seen when working
entirely within UTC, it&rsquo;s only when converting to or from TAI.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dminute"><span class="category-def">Function: </span><span><strong class="def-name">date-minute</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dminute"> &para;</a></span></dt>
<dd><p>Minutes, 0 to 59.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dhour"><span class="category-def">Function: </span><span><strong class="def-name">date-hour</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dhour"> &para;</a></span></dt>
<dd><p>Hour, 0 to 23.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dday"><span class="category-def">Function: </span><span><strong class="def-name">date-day</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dday"> &para;</a></span></dt>
<dd><p>Day of the month, 1 to 31 (or less, according to the month).
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dmonth"><span class="category-def">Function: </span><span><strong class="def-name">date-month</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dmonth"> &para;</a></span></dt>
<dd><p>Month, 1 to 12.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dyear"><span class="category-def">Function: </span><span><strong class="def-name">date-year</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dyear"> &para;</a></span></dt>
<dd><p>Year, eg. 2003. Dates B.C. are negative, eg. <em class="math">-46</em> is 46
B.C. There is no year 0, year <em class="math">-1</em> is followed by year 1.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dzone_002doffset"><span class="category-def">Function: </span><span><strong class="def-name">date-zone-offset</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dzone_002doffset"> &para;</a></span></dt>
<dd><p>Time zone, an integer number of seconds east of Greenwich.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dyear_002dday"><span class="category-def">Function: </span><span><strong class="def-name">date-year-day</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dyear_002dday"> &para;</a></span></dt>
<dd><p>Day of the year, starting from 1 for 1st January.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dweek_002dday"><span class="category-def">Function: </span><span><strong class="def-name">date-week-day</strong> <var class="def-var-arguments">date</var><a class="copiable-link" href="#index-date_002dweek_002dday"> &para;</a></span></dt>
<dd><p>Day of the week, starting from 0 for Sunday.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-date_002dweek_002dnumber"><span class="category-def">Function: </span><span><strong class="def-name">date-week-number</strong> <var class="def-var-arguments">date dstartw</var><a class="copiable-link" href="#index-date_002dweek_002dnumber"> &para;</a></span></dt>
<dd><p>Week of the year, ignoring a first partial week. <var class="var">dstartw</var> is the
day of the week which is taken to start a week, 0 for Sunday, 1 for
Monday, etc.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-current_002ddate"><span class="category-def">Function: </span><span><strong class="def-name">current-date</strong> <var class="def-var-arguments">[tz-offset]</var><a class="copiable-link" href="#index-current_002ddate"> &para;</a></span></dt>
<dd><p>Return a date object representing the current date/time, in UTC offset
by <var class="var">tz-offset</var>. <var class="var">tz-offset</var> is seconds east of Greenwich and
defaults to the local timezone.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-current_002djulian_002dday"><span class="category-def">Function: </span><span><strong class="def-name">current-julian-day</strong><a class="copiable-link" href="#index-current_002djulian_002dday"> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-julian-day-1"></a>
<p>Return the current Julian Day.
</p></dd></dl>
<dl class="first-deffn first-defun-alias-first-deffn">
<dt class="deffn defun-alias-deffn" id="index-current_002dmodified_002djulian_002dday"><span class="category-def">Function: </span><span><strong class="def-name">current-modified-julian-day</strong><a class="copiable-link" href="#index-current_002dmodified_002djulian_002dday"> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-modified-julian-day-1"></a>
<p>Return the current Modified Julian Day.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="SRFI_002d19-Time_002fDate-conversions.html">SRFI-19 Time/Date conversions</a>, Previous: <a href="SRFI_002d19-Time.html">SRFI-19 Time</a>, Up: <a href="SRFI_002d19.html">SRFI-19 - Time/Date Library</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>