Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Love may fail, but courtesy will previal." -- A Kurt Vonnegut fan


devel / comp.lang.python / Is there a Python module to parse a date like the 'date' command in Linux?

SubjectAuthor
* Is there a Python module to parse a date like the 'date' command in Linux?Chris Green
+- Re: Is there a Python module to parse a date like the 'date' commandMats Wichmann
+- Re: Is there a Python module to parse a date like the 'date' commandTim Williams
`* Re: Is there a Python module to parse a date like the 'date' commandMike Dewhirst
 `* Re: Is there a Python module to parse a date like the 'date' command in Linux?Chris Green
  +- Re: Is there a Python module to parse a date like the 'date' commandAlex Pinkney
  +- Re: Is there a Python module to parse a date like the 'date' commandMike Dewhirst
  `- Re: Is there a Python module to parse a date like the 'date' commandMike Dewhirst

1
Is there a Python module to parse a date like the 'date' command in Linux?

<l3lnjj-fr27.ln1@esprimo.zbmc.eu>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23316&group=comp.lang.python#23316

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl...@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Is there a Python module to parse a date like the 'date' command in Linux?
Date: Sat, 20 May 2023 20:53:57 +0100
Lines: 18
Message-ID: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 010q/mdaOrfPVhiJYav/gQ43d3rUtLoNyVOKNWEzEcINZOXAY=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:a1Qaqz5WAakPUB9knc6gWtzHgC0=
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/5.15.0-72-generic (x86_64))
 by: Chris Green - Sat, 20 May 2023 19:53 UTC

I'm converting a bash script to python as it has become rather clumsy
in bash.

However I have hit a problem with converting dates, the bash script
has:-

dat=$(date --date "$1" +"%Y/%m/%d")

and this will accept almost anything reasonably sensible that can be
interpreted as a date, in particular it accepts things like "tomorrow",
"yesterday" and "next thursday".

Is there anything similar in Python or would I be better off simply
using os.system() to run date from the python program?

--
Chris Green
·

Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.125.1684773560.13552.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23334&group=comp.lang.python#23334

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: mat...@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Mon, 22 May 2023 10:36:16 -0600
Lines: 23
Message-ID: <mailman.125.1684773560.13552.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<98e44c4e-a532-df52-3ea3-2a88ff46dc87@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de /h2S+BNtXfnKRfqiIrzb2wqxUFSGo9cmALqeMs7RebuA==
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=eMpbtAyq;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.015
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:module': 0.07;
'converting': 0.09; 'datetime': 0.09; 'library,': 0.09;
'subject:Python': 0.12; 'bash': 0.16; 'date,': 0.16; 'program?':
0.16; 'received:64.147': 0.16; 'sensible': 0.16; 'want,': 0.16;
'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'to:addr:python-
list': 0.20; 'run': 0.23; 'anything': 0.25; 'chris': 0.28; 'header
:User-Agent:1': 0.30; 'subject:there': 0.32; 'but': 0.32; "i'm":
0.33; 'there': 0.33; 'particular': 0.33; 'script': 0.33; 'header
:In-Reply-To:1': 0.34; 'using': 0.37; 'received:192.168': 0.37;
'simply': 0.63; 'similar': 0.65; 'accept': 0.67; 'received:64':
0.67; 'exactly': 0.68; 'interpreted': 0.69; 'subject: \n ': 0.84;
'green': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=q3kebnSxJOxB
yQc3RFkUMGBv7MRLI1CerYRr85rU5WU=; b=eMpbtAyq0VVFJLhrdGWz13uUXf2d
wdrwva9oTRhiEHTJIkhSTpZQXFlb6VQzt2WlvjpvhwhHpHexHDbqeQMdTPyQq6Xv
Bum3mtK/Q9n6qvh3TAJBF3ONSl89JjROU87ylGi6vTd4qg9xDz+ER43qvOXNUV6I
sbqpiwznODer0OM=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=q3kebnSxJOxByQc3RFkUMGBv7MRLI1CerYRr85rU5WU=;
b=MKHHSIuWJftwUhKa3O56/QInJsPZaUfSW2XGYHNdILvTotteG5zslRbEpZOzoOAPnyi/1GTRToWa77O7B0A4dzNG5/Jq5fan0UCpYgMNeWz9SSl2LUDW8gczPg6AOc/NsK19DtWZ433yMUq+s7k8nAnsn2UnPr/6cWonQ3Gj+Vc=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US
In-Reply-To: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
X-Pobox-Relay-ID: C6C4EA9C-F8BE-11ED-AEEC-307A8E0A682E-81526775!pb-smtp2.pobox.com
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <98e44c4e-a532-df52-3ea3-2a88ff46dc87@wichmann.us>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
 by: Mats Wichmann - Mon, 22 May 2023 16:36 UTC

On 5/20/23 13:53, Chris Green wrote:
> I'm converting a bash script to python as it has become rather clumsy
> in bash.
>
> However I have hit a problem with converting dates, the bash script
> has:-
>
> dat=$(date --date "$1" +"%Y/%m/%d")
>
> and this will accept almost anything reasonably sensible that can be
> interpreted as a date, in particular it accepts things like "tomorrow",
> "yesterday" and "next thursday".
>
> Is there anything similar in Python or would I be better off simply
> using os.system() to run date from the python program?
>

in the standard library, datetime

as an addon module, dateutil (install as python-dateutil)

Don't know if either are exactly what you want, but do take a look.

Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.126.1684786895.13552.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23335&group=comp.lang.python#23335

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: tjand...@gmail.com (Tim Williams)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Mon, 22 May 2023 16:21:23 -0400
Lines: 45
Message-ID: <mailman.126.1684786895.13552.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<98e44c4e-a532-df52-3ea3-2a88ff46dc87@wichmann.us>
<CAO39LaRreY-9eQeTBmdksP6c+7PsE_VOYgyuQpAo-n+fOzzjgQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de rqm7wya/ce/BdRXFdTMynQACjxFYf1rKYHK40XbyVLNg==
Return-Path: <tjandacw@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=fT0sAi+u;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2023': 0.07; 'string':
0.07; 'subject:module': 0.07; 'attempts': 0.09; 'converting':
0.09; 'datetime': 0.09; 'library,': 0.09; 'parse': 0.09;
'url:stable': 0.09; 'subject:Python': 0.12; '&gt;': 0.14;
'url:mailman': 0.15; 'applied:': 0.16; 'bash': 0.16; 'date,':
0.16; 'mats': 0.16; 'program?': 0.16; 'sensible': 0.16;
'unlikely': 0.16; 'want,': 0.16; 'wichmann': 0.16; 'wrote:': 0.16;
'problem': 0.16; 'python': 0.16; 'to:addr:python-list': 0.20;
'input': 0.21; '\xe2\x80\x94': 0.22; 'run': 0.23; 'anything':
0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24':
0.25; 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'object':
0.26; 'skip:+ 20': 0.26; 'chris': 0.28; 'module': 0.31; 'url-
ip:188/8': 0.31; 'formats': 0.32; 'returning': 0.32;
'subject:there': 0.32; 'message-id:@mail.gmail.com': 0.32; 'but':
0.32; "i'm": 0.33; 'there': 0.33; 'particular': 0.33; 'script':
0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'url-ip:104.17/16': 0.35;
'following': 0.35; 'from:addr:gmail.com': 0.35; 'mon,': 0.36;
'using': 0.37; '22,': 0.40; 'simply': 0.63; 'similar': 0.65;
'time.': 0.66; 'accept': 0.67; 'exactly': 0.68; 'interpreted':
0.69; 'rules': 0.70; 'href=""': 0.84; 'known': 0.84; 'stamp':
0.84; 'subject: \n ': 0.84; 'received:mail-lj1-x22b.google.com':
0.91; 'green': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1684786893; x=1687378893;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=kLtKbenBtw0thb116Bhe1Y48tYkjDcqhrowznw9VD0k=;
b=fT0sAi+uhuWI4ifJSQGOJmk7aG1f8KXM4KluRuGGZKuDdYOMPwgNkwlf+UGBysX75g
GrEAbCKbhI51HCPHnwt1JMX2714v7jKe43/EO27QG+XL7MsT30ngmU8xk5RpbKQitG3Q
0Re2peSOTdCk8G1y7m8ULiZy6al5yV7GzIWv+55dt6C/4st8SwTiZ1tpgr+y/IaXixEK
+dpqy3B2FNIT8vjS3A40Wq7S09/G4n8iBEzZ5VHOjYlOhB4H24TDDGPF84Nb6xvO/EBZ
o+7wt6KuEX7IBs2MAc1eeNh2mOtNVMBP7iRxNjnyS0eVmxM21jzgYKiCVOr+7yAPs0d2
qG6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1684786893; x=1687378893;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=kLtKbenBtw0thb116Bhe1Y48tYkjDcqhrowznw9VD0k=;
b=A5vhYv98kQX/cAdqzUFh4VyBEDEnZN0o++Y72IERMiRJSzXvEyhpyJA4EAcmUIWOti
TYghoEnZQL4B40tU/vKs7FdlFDrsqFieBOXu7XVpVVkWIwK8oNBG5w5TxnfiWQV4W0al
LcRUqEYyrvVapRoYRl8IC16ndOxkT6iZA8bs851WkRm9dcNPUvJXZXdWdEOFQC8f2l45
4IdGnla7ZhwwQB3fNF8EDJZY96GIGPHT/sHUp53RGF0ytgN/ojlfJoMScifVM8KJQDYF
0SrtICjgPPDh+4m+UJOvXCnEQYwGGS3x8QL0GHj3pCph6Pn3AyKHX9n3QodBLa6/+a9O
gdCw==
X-Gm-Message-State: AC+VfDzdyymVTc5VeauUq07/utHEHyVMIMUxLnc5uTV1wkDA2nK8d/79
nq55lImWNRJiYH1rgdd2xp0eMAkPWzOIQJo3D0QClRwjgQ==
X-Google-Smtp-Source: ACHHUZ6698oDiaqtyKS/HX8USiIurJk79DD5DWQt70WyUhIbgnfCBKjfFgHqoKDmFJ8OkQZUfcpm0gb+uRG1hwQI/4U=
X-Received: by 2002:a2e:8ed4:0:b0:2ad:9539:214c with SMTP id
e20-20020a2e8ed4000000b002ad9539214cmr4097844ljl.6.1684786892990; Mon, 22 May
2023 13:21:32 -0700 (PDT)
In-Reply-To: <98e44c4e-a532-df52-3ea3-2a88ff46dc87@wichmann.us>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAO39LaRreY-9eQeTBmdksP6c+7PsE_VOYgyuQpAo-n+fOzzjgQ@mail.gmail.com>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<98e44c4e-a532-df52-3ea3-2a88ff46dc87@wichmann.us>
 by: Tim Williams - Mon, 22 May 2023 20:21 UTC

On Mon, May 22, 2023 at 12:41 PM Mats Wichmann <mats@wichmann.us> wrote:

> On 5/20/23 13:53, Chris Green wrote:
> > I'm converting a bash script to python as it has become rather clumsy
> > in bash.
> >
> > However I have hit a problem with converting dates, the bash script
> > has:-
> >
> > dat=$(date --date "$1" +"%Y/%m/%d")
> >
> > and this will accept almost anything reasonably sensible that can be
> > interpreted as a date, in particular it accepts things like "tomorrow",
> > "yesterday" and "next thursday".
> >
> > Is there anything similar in Python or would I be better off simply
> > using os.system() to run date from the python program?
> >
>
> in the standard library, datetime
>
> as an addon module, dateutil (install as python-dateutil)
>
> Don't know if either are exactly what you want, but do take a look.
>
> --
> https://mail.python.org/mailman/listinfo/python-list

In particular,check out dateutil.parser.
parser — dateutil 2.8.2 documentation
<https://dateutil.readthedocs.io/en/stable/parser.html>

parser
<https://dateutil.readthedocs.io/en/stable/parser.html#module-dateutil.parser>

This module offers a generic date/time string parser which is able to parse
most known formats to represent a date and/or time.

This module attempts to be forgiving with regards to unlikely input
formats, returning a datetime object even for dates which are ambiguous. If
an element of a date/time stamp is omitted, the following rules are applied:

Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.3.1684801727.17425.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23341&group=comp.lang.python#23341

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: mik...@dewhirst.com.au (Mike Dewhirst)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Tue, 23 May 2023 10:22:49 +1000
Lines: 51
Message-ID: <mailman.3.1684801727.17425.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature";
boundary="------------eP2QXE7iZhdmqANwiJLRL1jt"
X-Trace: news.uni-berlin.de LHrWlNqdane+rdw7yvQr7ghUTkUVc+9WcfZ77vH0Eqpg==
Return-Path: <miked@dewhirst.com.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.012
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'absolute': 0.05; 'content-
type:multipart/signed': 0.05; 'subject:module': 0.07; 'content-
type:application/pgp-signature': 0.09; 'converting': 0.09;
'subject:Python': 0.12; 'import': 0.15; 'bash': 0.16; 'case?':
0.16; 'date,': 0.16; 'decrypt': 0.16; 'from:addr:dewhirst.com.au':
0.16; 'from:addr:miked': 0.16; 'from:name:mike dewhirst': 0.16;
'key.': 0.16; 'phishing.': 0.16; 'program?': 0.16;
'received:webmastery.com.au': 0.16; 'sensible': 0.16; 'wrote:':
0.16; 'problem': 0.16; 'python': 0.16; 'to:addr:python-list':
0.20; 'run': 0.23; 'anything': 0.25; 'chris': 0.28; 'header:User-
Agent:1': 0.30; 'am,': 0.31; 'subject:there': 0.32; "i'm": 0.33;
'there': 0.33; 'particular': 0.33; 'received:192.168.0': 0.33;
'script': 0.33; 'header:In-Reply-To:1': 0.34; 'received:au': 0.35;
'using': 0.37; 'received:192.168': 0.37; 'handle': 0.39; 'use':
0.39; 'me.': 0.62; 'simply': 0.63; 'email': 0.63; 'public': 0.63;
'key': 0.64; 'your': 0.64; 'came': 0.65; 'similar': 0.65;
'accept': 0.67; 'content-type:multipart/mixed': 0.68;
'interpreted': 0.69; 'private': 0.73; 'signature': 0.76; 'subject:
\n ': 0.84; 'received:103': 0.91; 'green': 0.96
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US
In-Reply-To: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
X-PPP-Message-ID: <20230523002252.18871.24420@plesk01.e1.webmastery.com.au>
X-PPP-Vhost: chemintro.com
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
 by: Mike Dewhirst - Tue, 23 May 2023 00:22 UTC
Attachments: "OpenPGP_signature" (application/pgp-signature)

On 21/05/2023 5:53 am, Chris Green wrote:
> I'm converting a bash script to python as it has become rather clumsy
> in bash.
What is the use case?
> However I have hit a problem with converting dates, the bash script
> has:-
>
> dat=$(date --date "$1" +"%Y/%m/%d")
>
> and this will accept almost anything reasonably sensible that can be
> interpreted as a date, in particular it accepts things like "tomorrow",
> "yesterday" and "next thursday".
>
> Is there anything similar in Python or would I be better off simply
> using os.system() to run date from the python program?
>

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

Attachments: "OpenPGP_signature" (application/pgp-signature)
Re: Is there a Python module to parse a date like the 'date' command in Linux?

<vscujj-f3ok.ln1@esprimo.zbmc.eu>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23343&group=comp.lang.python#23343

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl...@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command in Linux?
Date: Tue, 23 May 2023 10:16:47 +0100
Lines: 17
Message-ID: <vscujj-f3ok.ln1@esprimo.zbmc.eu>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu> <c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au> <mailman.3.1684801727.17425.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net +KnbQd48F/VDJVNyso9WjQPqbYSeYgnorJPAHdK2YEoVpCGik=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:F4yNDSRxhJ//OTPBXmEHf/QO0rM=
User-Agent: tin/2.6.2-20220130 ("Convalmore") (Linux/5.15.0-72-generic (x86_64))
 by: Chris Green - Tue, 23 May 2023 09:16 UTC

Mike Dewhirst <miked@dewhirst.com.au> wrote:
> [-- multipart/mixed, encoding 7bit, 22 lines --]
>
> [-- text/plain, encoding base64, charset: UTF-8, 16 lines --]
>
> On 21/05/2023 5:53 am, Chris Green wrote:
> > I'm converting a bash script to python as it has become rather clumsy
> > in bash.
>
> What is the use case?
>
A script I use to create diary entries, so it's very handy to be able
to give the date as 'yesterday' or 'friday'.

--
Chris Green
·

Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.4.1684861963.17425.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23348&group=comp.lang.python#23348

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: apinkne...@gmail.com (Alex Pinkney)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Tue, 23 May 2023 17:53:24 +0100
Lines: 26
Message-ID: <mailman.4.1684861963.17425.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
<CAGmkRsPS_-SuzjcYgJJV890jYoP9Z6bX3ErTUWN9j2eMjiN7Bw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de aYeb0indC+W+0O/tfLUQWQhiVoT8vujaXGtlM5TcnjYA==
Return-Path: <apinkney97@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=oECiBRHf;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:module': 0.07;
'cc:addr:python-list': 0.09; 'converting': 0.09; 'subject:Python':
0.12; '&gt;': 0.14; 'cc:no real name:2**0': 0.14; 'url:mailman':
0.15; 'bash': 0.16; 'case?': 0.16; 'encoding': 0.16; 'url:latest':
0.16; 'wrote:': 0.16; 'python': 0.16; 'tue,': 0.19;
'cc:addr:python.org': 0.20; 'lines': 0.23; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'cc:2**0': 0.25; 'url-ip:188.166/16': 0.25;
'chris': 0.28; 'am,': 0.31; 'url-ip:188/8': 0.31; 'subject:there':
0.32; 'message-id:@mail.gmail.com': 0.32; "i'm": 0.33; 'script':
0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'url-ip:104.17/16': 0.35;
'from:addr:gmail.com': 0.35; "it's": 0.37; 'use': 0.39; 'subject:
\n ': 0.84; 'green': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1684860816; x=1687452816;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=RG3Z9oEs881t3nyIqdk13TWdzNPzvhd3lZd4awcYjhw=;
b=oECiBRHfWfGD26dmvo7K+TY2npwG5ol5nVwIKWqikWS1l5Nk0/vRVDGlpLRp9sZWIm
WCqREkEUKKFPWin7wyqcehWe848U/bi9evFW3Gc1cHY4n4YpzVMkb+Apvpw5NTAI8WLY
2u6R1q4TQ9gjqUenEAL4w79vd3yZB8HIEgoEywC0thvvV0/NKUjpcya/zuAkGydoEmmZ
T+y0ZDPB4ck9qNNmtIhkWSdjamKSEU7Cu092jQdlRyCQjLM0XWrKvRrlSADdqXWICRL2
ETMrfnzscqiFCc7r45ELAGluzxVHMh6/ngMeKWVOFQVrC1neC5AfokUOwq4YXn/3o18l
vPQw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1684860816; x=1687452816;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=RG3Z9oEs881t3nyIqdk13TWdzNPzvhd3lZd4awcYjhw=;
b=O2n4tIx+rCBVPUO4fzKmGodqGSBv7iClkZDH6tElwt7IgbWTNur79tGvYyvwVWNNL/
cymQWJFbCe5ZXUXnJSKxTtgqqvzU0Y1CkmSZkCwumRO/3GtzKNtEAzZgACV6dOl/GtWf
P6TOxmXiSrbnqW9iwZXqSDTmcKm7kuWwNo0r4HoLxZWPTAbOeRhm7m63Jk0Y/57+vYdS
KYq4Z7ETF1pmKhwTZwivrGbRVKd86GVL3kW8aLUJfzUez1J0+cWhgMTtX35dlK5YnN5C
rrL7/zk7M18SEil36t14g8lVUnQgFeyVB3r4fbqxMGneTeWUYVLbp0J8WKvOH1oXHEeb
RHVQ==
X-Gm-Message-State: AC+VfDzP32UP/hC47+GkoFGNr2jRDfaNChUytOVYehcdPBtV1DjaTjXM
ersyFoDiV3geuxuyjZaIM4oCuwtOon9hS4Mf/qBMg87G
X-Google-Smtp-Source: ACHHUZ6Q9NppPA/nTRF3WN85krfGGyVFcvb0dxOZF9PzM0Rd65ZmqjKQD3H2iEJD452ifPDNOvMKvvs30QQ2LQ15UW4=
X-Received: by 2002:a05:6402:5108:b0:50d:56f3:76ed with SMTP id
m8-20020a056402510800b0050d56f376edmr20221867edd.11.1684860815822; Tue, 23
May 2023 09:53:35 -0700 (PDT)
In-Reply-To: <vscujj-f3ok.ln1@esprimo.zbmc.eu>
X-Mailman-Approved-At: Tue, 23 May 2023 13:12:42 -0400
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAGmkRsPS_-SuzjcYgJJV890jYoP9Z6bX3ErTUWN9j2eMjiN7Bw@mail.gmail.com>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
 by: Alex Pinkney - Tue, 23 May 2023 16:53 UTC

On Tue, 23 May 2023, 17:25 Chris Green, <cl@isbd.net> wrote:

> Mike Dewhirst <miked@dewhirst.com.au> wrote:
> > [-- multipart/mixed, encoding 7bit, 22 lines --]
> >
> > [-- text/plain, encoding base64, charset: UTF-8, 16 lines --]
> >
> > On 21/05/2023 5:53 am, Chris Green wrote:
> > > I'm converting a bash script to python as it has become rather clumsy
> > > in bash.
> >
> > What is the use case?
> >
> A script I use to create diary entries, so it's very handy to be able
> to give the date as 'yesterday' or 'friday'.
>
> --
> Chris Green
> ·
> --
> https://mail.python.org/mailman/listinfo/python-list

Hi, you may find dateparser useful:
https://dateparser.readthedocs.io/en/latest/

Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.23.1684915239.17425.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23376&group=comp.lang.python#23376

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.imp.ch!fu-berlin.de!uni-berlin.de!not-for-mail
From: mik...@dewhirst.com.au (Mike Dewhirst)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Wed, 24 May 2023 18:00:28 +1000
Lines: 55
Message-ID: <mailman.23.1684915239.17425.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
<35891e6a-ef32-9497-bdc7-221d0ead167b@dewhirst.com.au>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature";
boundary="------------7kl07ReMg7D8GmJAJOEmcsNo"
X-Trace: news.uni-berlin.de 38Mgp4n7ii+9tJQyeHdRQQmTQ1/E1Fptrx4H2H5i5pdA==
Return-Path: <miked@dewhirst.com.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.010
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'absolute': 0.05; 'content-
type:multipart/signed': 0.05; 'subject:module': 0.07; 'content-
type:application/pgp-signature': 0.09; 'converting': 0.09;
'subject:Python': 0.12; 'import': 0.15; 'bash': 0.16; 'case?':
0.16; 'decrypt': 0.16; 'encoding': 0.16; 'filename': 0.16;
'from:addr:dewhirst.com.au': 0.16; 'from:addr:miked': 0.16;
'from:name:mike dewhirst': 0.16; 'key.': 0.16; 'phishing.': 0.16;
'received:webmastery.com.au': 0.16; 'wrote:': 0.16; 'python':
0.16; 'pm,': 0.19; 'to:addr:python-list': 0.20; 'maybe': 0.22;
'lines': 0.23; '>>>': 0.28; 'chris': 0.28; 'header:User-Agent:1':
0.30; 'am,': 0.31; 'subject:there': 0.32; 'but': 0.32; "i'm":
0.33; 'received:192.168.0': 0.33; 'script': 0.33; 'able': 0.34;
'header:In-Reply-To:1': 0.34; 'received:au': 0.35; "it's": 0.37;
'received:192.168': 0.37; 'handle': 0.39; 'use': 0.39; 'today':
0.61; 'me.': 0.62; 'email': 0.63; 'public': 0.63; 'key': 0.64;
'your': 0.64; 'came': 0.65; 'content-type:multipart/mixed': 0.68;
'private': 0.73; 'delivers': 0.76; 'signature': 0.76; 'subject: \n
': 0.84; 'received:103': 0.91; 'green': 0.96
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US
In-Reply-To: <vscujj-f3ok.ln1@esprimo.zbmc.eu>
X-PPP-Message-ID: <20230524080032.6217.67561@plesk01.e1.webmastery.com.au>
X-PPP-Vhost: chemintro.com
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <35891e6a-ef32-9497-bdc7-221d0ead167b@dewhirst.com.au>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
 by: Mike Dewhirst - Wed, 24 May 2023 08:00 UTC
Attachments: "OpenPGP_signature" (application/pgp-signature)

On 23/05/2023 7:16 pm, Chris Green wrote:
> Mike Dewhirst<miked@dewhirst.com.au> wrote:
>> [-- multipart/mixed, encoding 7bit, 22 lines --]
>>
>> [-- text/plain, encoding base64, charset: UTF-8, 16 lines --]
>>
>> On 21/05/2023 5:53 am, Chris Green wrote:
>>> I'm converting a bash script to python as it has become rather clumsy
>>> in bash.
>> What is the use case?
>>
> A script I use to create diary entries, so it's very handy to be able
> to give the date as 'yesterday' or 'friday'.
OK - I thought maybe baklabel might suit, but that delivers a day-name
(backup filename prefix) for today or a given date
>

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

Attachments: "OpenPGP_signature" (application/pgp-signature)
Re: Is there a Python module to parse a date like the 'date' command in Linux?

<mailman.50.1685602730.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23491&group=comp.lang.python#23491

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.imp.ch!fu-berlin.de!uni-berlin.de!not-for-mail
From: mik...@dewhirst.com.au (Mike Dewhirst)
Newsgroups: comp.lang.python
Subject: Re: Is there a Python module to parse a date like the 'date' command
in Linux?
Date: Thu, 1 Jun 2023 16:53:01 +1000
Lines: 69
Message-ID: <mailman.50.1685602730.23016.python-list@python.org>
References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
<35891e6a-ef32-9497-bdc7-221d0ead167b@dewhirst.com.au>
<0b16a809-d947-4f41-07c4-50c93451228c@dewhirst.com.au>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature";
boundary="------------13JCQ42SUPcNPwAx0Su9o01H"
X-Trace: news.uni-berlin.de /acYsVWw6X1qcJwauSzpwgx/VB1IAx1fdbGoEqKdu7Gg==
Return-Path: <miked@dewhirst.com.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url-ip:140.82/16': 0.03;
'knows': 0.04; 'absolute': 0.05; 'content-type:multipart/signed':
0.05; 'pypi': 0.05; 'subject:module': 0.07; 'content-
type:application/pgp-signature': 0.09; 'converting': 0.09;
'subject:Python': 0.12; 'url:github': 0.14; 'import': 0.15; 'url-
ip:140/8': 0.15; '6:00': 0.16; '>>>>': 0.16; 'assumption': 0.16;
'bash': 0.16; 'case?': 0.16; 'decrypt': 0.16; 'encoding': 0.16;
'filename': 0.16; 'from:addr:dewhirst.com.au': 0.16;
'from:addr:miked': 0.16; 'from:name:mike dewhirst': 0.16; 'key.':
0.16; 'phishing.': 0.16; 'received:webmastery.com.au': 0.16;
'resolving': 0.16; 'wrote:': 0.16; 'python': 0.16; 'github': 0.17;
'pm,': 0.19; 'to:addr:python-list': 0.20; 'maybe': 0.22; 'lines':
0.23; 'local': 0.27; '>>>': 0.28; 'chris': 0.28; 'header:User-
Agent:1': 0.30; 'am,': 0.31; 'subject:there': 0.32; 'but': 0.32;
"i'm": 0.33; 'received:192.168.0': 0.33; 'script': 0.33; 'server':
0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34; 'received:au':
0.35; "it's": 0.37; 'received:192.168': 0.37; 'changes': 0.39;
'handle': 0.39; 'use': 0.39; 'usa': 0.60; 'today': 0.61; 'me.':
0.62; 'email': 0.63; 'public': 0.63; 'key': 0.64; 'your': 0.64;
'came': 0.65; '[1]': 0.67; 'content-type:multipart/mixed': 0.68;
'private': 0.73; 'june': 0.73; 'delivers': 0.76; 'signature':
0.76; 'subject: \n ': 0.84; 'received:103': 0.91; 'green': 0.96
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.2
Content-Language: en-US
In-Reply-To: <35891e6a-ef32-9497-bdc7-221d0ead167b@dewhirst.com.au>
X-PPP-Message-ID: <20230601065305.1800.46493@plesk01.e1.webmastery.com.au>
X-PPP-Vhost: chemintro.com
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <0b16a809-d947-4f41-07c4-50c93451228c@dewhirst.com.au>
X-Mailman-Original-References: <l3lnjj-fr27.ln1@esprimo.zbmc.eu>
<c7b1066f-2644-a054-7582-bacc0061d20a@dewhirst.com.au>
<mailman.3.1684801727.17425.python-list@python.org>
<vscujj-f3ok.ln1@esprimo.zbmc.eu>
<35891e6a-ef32-9497-bdc7-221d0ead167b@dewhirst.com.au>
 by: Mike Dewhirst - Thu, 1 Jun 2023 06:53 UTC
Attachments: "OpenPGP_signature" (application/pgp-signature)

On 24/05/2023 6:00 pm, Mike Dewhirst wrote:
> On 23/05/2023 7:16 pm, Chris Green wrote:
>> Mike Dewhirst<miked@dewhirst.com.au> wrote:
>>> [-- multipart/mixed, encoding 7bit, 22 lines --]
>>>
>>> [-- text/plain, encoding base64, charset: UTF-8, 16 lines --]
>>>
>>> On 21/05/2023 5:53 am, Chris Green wrote:
>>>> I'm converting a bash script to python as it has become rather clumsy
>>>> in bash.
>>> What is the use case?
>>>
>> A script I use to create diary entries, so it's very handy to be able
>> to give the date as 'yesterday' or 'friday'.
>
> OK - I thought maybe baklabel might suit, but that delivers a day-name
> (backup filename prefix) for today or a given date
I have just refreshed baklabel on PyPI and upped it from my local svn
server to github [1]
The changes include resolving ambiguous dates across locales eg USA vs
Australia 5/6/2023 being detected as May in USA and June in Australia on
the assumption that the user knows what is required.
[1] https://github.com/mdewhirst/baklabel
>
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Your
> email software can handle signing.
--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

Attachments: "OpenPGP_signature" (application/pgp-signature)
1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor