Message from discussion
parsing a date
Received: by 10.66.83.35 with SMTP id n3mr1118644pay.23.1348798044097;
Thu, 27 Sep 2012 19:07:24 -0700 (PDT)
Path: t10ni23589184pbh.0!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!usenet.stanford.edu!not-for-mail
From: Eric Abrahamsen <e...@ericabrahamsen.net>
Newsgroups: gnu.emacs.help
Subject: parsing a date
Date: Fri, 28 Sep 2012 10:07:08 +0800
Lines: 22
Approved: help-gnu-em...@gnu.org
Message-ID: <mailman.9885.1348798043.855.help-gnu-emacs@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
X-Trace: usenet.stanford.edu 1348798043 21705 208.118.235.17 (28 Sep 2012 02:07:23 GMT)
X-Complaints-To: action@cs.stanford.edu
To: help-gnu-em...@gnu.org
Envelope-to: help-gnu-em...@gnu.org
X-Injected-Via-Gmane: http://gmane.org/
X-Gmane-NNTP-Posting-Host: 114.250.125.247
X-Pgp-Key: http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0xC98BAE7B99D0D373
X-Pgp-Fingerprint: 8E19 28A9 2B51 0C67 565D DB34 C98B AE7B 99D0 D373
User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)
Cancel-Lock: sha1:K8bXrAUJhsUjsdaDuXmYivhk7Sw=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-Received-From: 80.91.229.3
X-BeenThere: help-gnu-em...@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
<mailto:help-gnu-emacs-requ...@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-em...@gnu.org>
List-Help: <mailto:help-gnu-emacs-requ...@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
<mailto:help-gnu-emacs-requ...@gnu.org?subject=subscribe>
Bytes: 2516
X-Received-Bytes: 2564
Content-Type: text/plain
I'm reading in files with dates in this format: "2011-11-25". I need to
write them out as "2011/11/25". Instead of just manhandling the strings
(I'll likely need this date information in other places) I wanted to
parse the strings into proper date objects, then format them back into
strings. `date-to-time' doesn't work because (parse-time-string
"2011-11-15") gives me:
(nil nil nil 15 11 2011 nil nil nil)
Which is not acceptable to `encode-time', because it requires integers,
not nil. I can't believe this is quite this complicated: do I really
have to replace all the nils with 0 myself?
Any pointers gratefully accepted,
Eric
--
GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.4)
of 2012-09-16 on pellet