From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.bugs Subject: bug#46505: 27.1.91; Having a hard time manipulating a date Date: Sun, 14 Feb 2021 11:42:49 +0100 Message-ID: <878s7rudzq.fsf@cassou.me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13119"; mail-complaints-to="usenet@ciao.gmane.io" To: 46505@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 14 11:44:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBEss-0003JC-SK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Feb 2021 11:44:10 +0100 Original-Received: from localhost ([::1]:39278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBEsr-00088V-UY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Feb 2021 05:44:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBEsk-00088J-H6 for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2021 05:44:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBEsk-0003Gm-8m for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2021 05:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lBEsk-0008H5-5p for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2021 05:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Damien Cassou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Feb 2021 10:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46505 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161329939131738 (code B ref -1); Sun, 14 Feb 2021 10:44:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Feb 2021 10:43:11 +0000 Original-Received: from localhost ([127.0.0.1]:35479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBErv-0008Fp-E3 for submit@debbugs.gnu.org; Sun, 14 Feb 2021 05:43:11 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBErr-0008Ff-Jw for submit@debbugs.gnu.org; Sun, 14 Feb 2021 05:43:10 -0500 Original-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 ) id 1lBErr-000864-Cf for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2021 05:43:07 -0500 Original-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 ) id 1lBErn-00031N-A1 for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2021 05:43:07 -0500 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 663E01818FAFD for ; Sun, 14 Feb 2021 11:42:51 +0100 (CET) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id x4rdZf8on06n for ; Sun, 14 Feb 2021 11:42:50 +0100 (CET) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id BD80B1819578C for ; Sun, 14 Feb 2021 11:42:50 +0100 (CET) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id kkHXTfWahHD9 for ; Sun, 14 Feb 2021 11:42:50 +0100 (CET) Original-Received: from localhost (216.138.120.78.rev.sfr.net [78.120.138.216]) by mail.choca.pics (Postfix) with ESMTPSA id 7C2E718191BB1 for ; Sun, 14 Feb 2021 11:42:50 +0100 (CET) Received-SPF: pass client-ip=2001:910:1410:500::1; envelope-from=damien@cassou.me; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199990 Archived-At: 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