No description
Find a file
Juan Carlos d9f1b5038c
Merge pull request #1 from prasad83/master
Fixed divmod to return tuple instead of array.
2023-10-12 09:13:59 -03:00
.github Create FUNDING.yml 2019-11-04 07:58:03 -03:00
src Fixed divmod to return tuple instead of array. 2023-10-12 13:53:15 +05:30
.gitignore Initial commit 2018-05-05 23:03:23 -03:00
datetime2human.nimble Update for Nim 1.4 2020-10-04 20:49:36 -03:00
LICENSE Initial commit 2018-05-05 23:03:23 -03:00
README.md Improve the README.md 2018-05-05 23:19:06 -03:00

nim-datetime2human

Calculate date & time with precision from seconds to millenniums. Human friendly date time as string. ISO-8601.

screenshot

Use

>>> 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

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.