Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juancarlospaco/nim-datetime2human
Calculate date & time with precision from seconds to millenniums. Human friendly date time as string. ISO-8601 representation and more.
https://github.com/juancarlospaco/nim-datetime2human
datetime human human-friendly iso8601 nim nim-lang
Last synced: 21 days ago
JSON representation
Calculate date & time with precision from seconds to millenniums. Human friendly date time as string. ISO-8601 representation and more.
- Host: GitHub
- URL: https://github.com/juancarlospaco/nim-datetime2human
- Owner: juancarlospaco
- License: lgpl-3.0
- Created: 2018-05-06T02:03:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-12T12:13:59.000Z (about 1 year ago)
- Last Synced: 2024-08-04T01:15:00.513Z (3 months ago)
- Topics: datetime, human, human-friendly, iso8601, nim, nim-lang
- Language: Nim
- Size: 16.6 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - datetime2human - Calculate date & time with precision from seconds to millenniums. Human friendly date time as string. ISO-8601. (Operating System / Date and Time)
README
# nim-datetime2human
Calculate date & time with precision from seconds to millenniums.
Human friendly date time as string. ISO-8601.![screenshot](https://source.unsplash.com/BXOXnQ26B7o/800x402 "Illustrative Photo by https://unsplash.com/@aronvisuals")
# Use
```nim
>>> import datetime2human
>>> echo datetime2human(now())
(human: "5 Decades 2 Years 6 Months 2 Weeks 3 Days 2 Hours 4 Minutes 16 Seconds", short: "5 Decades", iso: "2018-05-05 23:04:16-03:00", units: (seconds: 16, minutes: 4, hours: 2, days: 3, weeks: 2, months: 6, years: 2, decades: 5, centuries: 0, millenniums: 0))
echo now2human()
(human: "5 Decades 2 Years 6 Months 2 Weeks 3 Days 2 Hours 4 Minutes 16 Seconds", short: "5 Decades", iso: "2018-05-05 23:04:16-03:00", units: (seconds: 16, minutes: 4, hours: 2, days: 3, weeks: 2, months: 6, years: 2, decades: 5, centuries: 0, millenniums: 0))
>>>
```# Install
```
nimble install datetime2human
```# Requisites
- [Nim](https://nim-lang.org)
# Documentation
datetime2human()
**Description:**
Calculate date & time with precision from seconds to millenniums.
Human friendly date time as string. ISO-8601 representation.
The proc only accepts `DateTime`.**Arguments:**
- `datetime_obj` A valid `DateTime` object, `DateTime` type, required.**Returns:** `HumanTimes` type, a tuple.
now2human()
**Description:**
Now expressed as human friendly time units string, Just a shortcut to `datetime2human`.**Arguments:** None.
**Returns:** `HumanTimes` type, a tuple.