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; Severity: minor; Reported by: Damien Cassou <damien@HIDDEN>; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 29.1, send any further explanations to 46505 <at> debbugs.gnu.org and Damien Cassou <damien@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 46505) by debbugs.gnu.org; 17 Jun 2022 14:05:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 17 10:05:35 2022
Received: from localhost ([127.0.0.1]:46531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1o2CbO-0002V1-OH
	for submit <at> debbugs.gnu.org; Fri, 17 Jun 2022 10:05:34 -0400
Received: from quimby.gnus.org ([95.216.78.240]:56168)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1o2CbJ-0002Ug-4B
 for 46505 <at> debbugs.gnu.org; Fri, 17 Jun 2022 10:05:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=xIbyVmGFlnlqM0Q/fcSp+ancVhOmsH4KMDjLu85Kf9E=; b=OQgZyQLm6hSv40zBgYf2HOFcbA
 EmYdJgoeXUs7Yb1MQbB5c/zA2RtbhDXYmEaKJZfQT4X2RwRaiTl7xRjb+XhynVr09Jrn89O4Z+QSt
 XOILSwFuyVOS4k1E0kMNw46dvToijVq0GZ9fdHbBWQeryL5lFUcReYU8x9mww6KW1t/M=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1o2Cb5-0003kX-HZ; Fri, 17 Jun 2022 16:05:21 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Damien Cassou <damien@HIDDEN>
Subject: Re: bug#46505: 27.1.91; Having a hard time manipulating a date
References: <878s7rudzq.fsf@HIDDEN>
X-Now-Playing: Fairport Convention's _Come All Ye (2)_: "Come All Ye (Take 1)"
Date: Fri, 17 Jun 2022 16:05:14 +0200
In-Reply-To: <878s7rudzq.fsf@HIDDEN> (Damien Cassou's message of "Sun, 14
 Feb 2021 11:42:49 +0100")
Message-ID: <87y1xv75d1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Damien Cassou <damien@HIDDEN> writes: > 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 2n [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 46505
Cc: 46505 <at> debbugs.gnu.org
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: -3.3 (---)

Damien Cassou <damien@HIDDEN> writes:

> 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"

format-time-string takes Lisp timestamps as arguments, not decoded time
structures, and I don't think that could change -- the formats are
syntactically ambiguous.

> - 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.

But I've now improved the documentation here to clarify which functions
take and return Lisp timestamps vs. decoded time structures.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#46505; Package emacs. Full text available.

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: Fri, 17 Jun 2022 14:15:02 UTC

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