From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: parsing a date
Date: Mon, 24 Dec 2012 11:02:12 +0800 [thread overview]
Message-ID: <87623s885n.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 50D7A429.30009@mousecar.com
ken <gebser@mousecar.com> writes:
> On 12/23/2012 12:55 AM Eric Abrahamsen wrote:
>> (format-time-string "%Y/%m/%d"
>>> (apply 'encode-time 0 0 0
>>> (nthcdr 3 (parse-time-string "2011-11-15"))))
>
> Nice. I was wanting to do something very close to this awhile back.
> Of course the above code is more useful in the context of a function,
> something like the below-- which has something missing. What?
>
> (setq ddd "2013-02-11.tail") ;Want to remove tail on string also
>
> (defun ddd
> (format-time-string "%A, %B %d, %Y"
> (apply 'encode-time 0 0 0
> (nthcdr 3 (parse-time-string ddd)))))
I suppose this?
--8<---------------cut here---------------start------------->8---
(defun ddd (s)
(format-time-string "%Y/%m/%d"
(apply 'encode-time 0 0 0
(nthcdr 3 (parse-time-string
(replace-regexp-in-string "\.tail" "" s))))))
--8<---------------cut here---------------end--------------->8---
next prev parent reply other threads:[~2012-12-24 3:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.9885.1348798043.855.help-gnu-emacs@gnu.org>
2012-12-02 7:25 ` parsing a date WJ
2012-12-23 5:55 ` Eric Abrahamsen
2012-12-24 0:39 ` ken
2012-12-24 3:02 ` Eric Abrahamsen [this message]
2012-12-24 3:54 ` ken
2012-09-28 2:07 Eric Abrahamsen
2012-09-28 2:50 ` Óscar Fuentes
2012-09-28 3:20 ` Eric Abrahamsen
2012-09-28 4:14 ` Óscar Fuentes
2012-09-28 6:11 ` Eric Abrahamsen
[not found] ` <mailman.9889.1348812706.855.help-gnu-emacs@gnu.org>
2012-10-14 1:51 ` David Combs
2012-10-14 7:18 ` Eric Abrahamsen
[not found] ` <mailman.9886.1348800663.855.help-gnu-emacs@gnu.org>
2012-09-29 17:00 ` Stefan Monnier
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=87623s885n.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=help-gnu-emacs@gnu.org \
/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.