emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Bala Ramadurai <nikimonikado@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: help with sexp in org-capture-template
Date: Sun, 05 Apr 2020 20:36:32 +0000	[thread overview]
Message-ID: <87pncl1xgv.fsf@kyleam.com> (raw)
In-Reply-To: <CABp2F2aro=kiN2NDC6gRHWjQVWoRspC2WcFB6CR1Cz3yS8yBkg@mail.gmail.com>

Hi Bala,

Bala Ramadurai <nikimonikado@gmail.com> writes:

> I am working on a org-capture-template and one of the entries is a date (30
> days later) I want in European format.
> My solution is this:
> | *Due Date*: %(concat (substring (org-read-date nil nil "+30d") 8 10) "-"
> (substring(org-read-date nil nil "+30d") 5 7) "-" (substring(org-read-date
> nil nil "+30d") 0 4)) |
> Although this does the job, it is extremely inelegant and only reflects my
> poor knowledge in elisp.
> Can any of you please help me in making this code better?

Does the job is the important part :)  One thing you could do that'd
make it a little nicer to my eyes is let-binding

  (org-read-date nil nil "+30d")

result to avoid calling it three times.

Here's another approach:

    (format-time-string "%d-%m-%Y" (time-add (days-to-time 30) nil))

      reply	other threads:[~2020-04-05 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.57.1585670407.11838.emacs-orgmode@gnu.org>
2020-04-01  5:10 ` help with sexp in org-capture-template Bala Ramadurai
2020-04-05 20:36   ` Kyle Meyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pncl1xgv.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nikimonikado@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).