From: Bastien <bzg@gnu.org>
To: Mirko <mirko.vukovic@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: what function to use to normalize date to org format?
Date: Fri, 11 Apr 2014 11:20:23 +0200 [thread overview]
Message-ID: <87sipk3srz.fsf@bzg.ath.cx> (raw)
In-Reply-To: <loom.20140327T142529-706@post.gmane.org> (Mirko's message of "Thu, 27 Mar 2014 13:32:14 +0000 (UTC)")
Hi Mirko,
Mirko <mirko.vukovic@gmail.com> writes:
> Is there a public function that can accept a string such as "3/4/5" (US
> Format) and normalize it to [2005-03-04 Fri]?.
Here you go:
(defun mirko-timestamp-conversion (date-string)
(when (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date-string)
(let* ((time
(list 0 0 0
(string-to-number (match-string 2 date-string))
(string-to-number (match-string 1 date-string))
(+ (string-to-number (match-string 3 date-string)) 2000)))
(etime (apply 'encode-time time)))
(format-time-string "[%Y-%m-%d %a]" etime))))
(mirko-timestamp-conversion "3/4/5")
=> [2005-03-04 Fri.]
--
Bastien
prev parent reply other threads:[~2014-04-11 13:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 13:32 what function to use to normalize date to org format? Mirko
2014-04-11 9:20 ` Bastien [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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sipk3srz.fsf@bzg.ath.cx \
--to=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=mirko.vukovic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.