GNU bug report logs - #46505
27.1.91; Having a hard time manipulating a date

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Damien Cassou <damien@HIDDEN>; dated Sun, 14 Feb 2021 10:44:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Feb 2021 10:43:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 14 05:43:11 2021
Received: from localhost ([127.0.0.1]:35479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lBErv-0008Fp-E3
	for submit <at> debbugs.gnu.org; Sun, 14 Feb 2021 05:43:11 -0500
Received: from lists.gnu.org ([209.51.188.17]:40890)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <damien@HIDDEN>) id 1lBErr-0008Ff-Jw
 for submit <at> debbugs.gnu.org; Sun, 14 Feb 2021 05:43:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:53176)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <damien@HIDDEN>) id 1lBErr-000864-Cf
 for bug-gnu-emacs@HIDDEN; Sun, 14 Feb 2021 05:43:07 -0500
Received: from mail.choca.pics ([2001:910:1410:500::1]:35980)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <damien@HIDDEN>) id 1lBErn-00031N-A1
 for bug-gnu-emacs@HIDDEN; Sun, 14 Feb 2021 05:43:07 -0500
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id 663E01818FAFD
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Feb 2021 11:42:51 +0100 (CET)
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032)
 with ESMTP id x4rdZf8on06n for <bug-gnu-emacs@HIDDEN>;
 Sun, 14 Feb 2021 11:42:50 +0100 (CET)
Received: from localhost (localhost.localdomain [IPv6:::1])
 by mail.choca.pics (Postfix) with ESMTP id BD80B1819578C
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Feb 2021 11:42:50 +0100 (CET)
X-Virus-Scanned: amavisd-new at choca.pics
Received: from mail.choca.pics ([IPv6:::1])
 by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026)
 with ESMTP id kkHXTfWahHD9 for <bug-gnu-emacs@HIDDEN>;
 Sun, 14 Feb 2021 11:42:50 +0100 (CET)
Received: from localhost (216.138.120.78.rev.sfr.net [78.120.138.216])
 by mail.choca.pics (Postfix) with ESMTPSA id 7C2E718191BB1
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Feb 2021 11:42:50 +0100 (CET)
From: Damien Cassou <damien@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.1.91; Having a hard time manipulating a date
Date: Sun, 14 Feb 2021 11:42:49 +0100
Message-ID: <878s7rudzq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2001:910:1410:500::1;
 envelope-from=damien@HIDDEN; helo=mail.choca.pics
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Hi,

I'm finding it very hard to manipulate dates.

What I want:

Example input: "2021-01-20"
Corresponding expected output: "20 Jan 2021"

What I tried:

  (format-time-string "%d %b %Y" (iso8601-parse "2021-01-20"))
    =E2=87=92 invalid time specification

  (format-time-string "%d %b %Y" (iso8601-parse "2021-01-20T00:00:00"))
    =E2=87=92 "01 Jan 1970"  ;; note the wrong year

What works:

  (format-time-string
       "%d %b %Y"
       (encode-time (iso8601-parse "2021-01-20T00:00:00")))
    =E2=87=92 "20 Jan 2021"

I found the Elisp manual confusing with all the date formats, all the
functions and their different kinds of arguments.

Possible improvements:

- make format-time-string accept as 2nd argument the return value of
  (iso8601-parse "2021-01-20T00:00:00") with a correct year

- make format-time-string accept as 2nd argument the return value of
  (iso8601-parse "2021-01-20") without sending an "invalid time
  specification"

- restructure the manual to start with a page describing the different
  time formats used throughout Emacs with a table listing all conversion
  functions, the kind of input they take and the kind of output they
  generate and examples for each.

In GNU Emacs 27.1.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.21, cairo version 1.16.0) Windowing system distributor 'Fedora
Project', version 11.0.12010000 System Description: Fedora 33
(Workstation Edition)

Best,

--=20
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




Acknowledgement sent to Damien Cassou <damien@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#46505; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 14 Feb 2021 10:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.