Emacs Lisp: age

Emacs Lisp: age

Returns the age of people by using the PostgreSQL. It is very usable to find the age of children, relatives, friends.

Example usage of a function in the Org mode table:

|  Date born | Name               | Age                        |
|------------+--------------------+----------------------------|
|          / | <                  | <                          |
| 2009-06-07 | Your Friend      | 10 years 10 months 13 days |
#+TBLFM: $3='(age "@$1");L
(defun age (date)
  "Returns the age by using PostgreSQL. It is usable to find out
the age of people"
  (let* ((command (format "psql -Stc \"SELECT age(date('%s'));\"" date))
     (age (shell-command-to-string command))
     (age (string-trim age))
     (age (replace-regexp-in-string " mon " " month " age))
     (age (replace-regexp-in-string " mons " " months " age)))
    age))

Related pages

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: