| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.99.0/library/dates/NOTES.md |
This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2026 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
dates
The date object implements some useful calendar date predicates.
It also provides portable predicates for date-time handling, including:
duration(Days, Hours, Minutes, Seconds) â a fixed-length duration converted to secondsduration(Years, Months, Days, Hours, Minutes, Seconds) â a calendar-aware period where the year and month delta is applied first using calendar arithmetic, clamping the day to the last valid day of the resulting month when necessary (e.g. adding one month to January 31 gives February 28 or 29 depending on the year), with the remaining day and time delta applied via fixed-length arithmetic. The duration_between/3 predicate returns this form when called with a 6-arity skeleton such as duration(Yr, Mo, Da, Hr, Mi, Se).
Date-time values are represented using the date_time/6 compound term:date_time(Year, Month, Day, Hours, Minutes, Seconds)
The format_date_time/4 predicate currently supports the named formats
rfc3339, iso8601, atom, rfc2822, rfc5322, rss, http_date,
rfc1123, unix_date, common_log, date_short, date_medium,
date_long, date_full, time_short, time_medium, time_long,
time_full, date_time_short, date_time_medium, date_time_long,
and date_time_full.
The explicit offset argument is given in seconds. Formats that include
numeric offsets require offsets representable in whole minutes. The
http_date and rfc1123 formats always normalize the output to GMT.
The style presets are currently English-only presentation formats:
date_short -> 2026-04-08date_medium -> `8 Apr 2026`date_long -> `April 8, 2026`date_full -> `Tuesday, April 8, 2026`time_short -> 13:45time_medium -> 13:45:30time_long -> 13:45:30 +01:00time_full -> `1:45:30 PM +01:00`date_time_short -> 2026-04-08 13:45date_time_medium -> `8 Apr 2026 13:45:30`date_time_long -> `April 8, 2026 1:45:30 PM +01:00`date_time_full -> `Tuesday, April 8, 2026 1:45:30 PM +01:00
The time` object implements some useful time predicates.
Please note that the functionality of these objects depends on the chosen Prolog support for accessing the operating system time and date.
Open the [../../apis/library_index.html#dates](../../apis/library_index.html#dates) link in a web browser.
To load all entities in this library, load the loader.lgt utility file:
| ?- logtalk_load(dates(loader)).
To test this library predicates, load the tester.lgt file:
| ?- logtalk_load(dates(tester)).