On Thu, Dec 16, 2021 at 10:33 AM Vladimir Botka <[email protected]> wrote:
>
> On Thu, 16 Dec 2021 06:30:59 -0800 (PST)
> "[email protected]" <[email protected]> wrote:
>
> > And it gives me this:
> >
> > "msg": "test.user1 / [email protected] / 20210715141027Z / 7776000"
>
> For example
>
> - hosts: localhost
>   vars:
>     warning_users:
>       - {uid: user1, mail: [email protected], pwdexp: 20210715141027Z}
>       - {uid: user2, mail: [email protected], pwdexp: 20210716141027Z}
>       - {uid: user3, mail: [email protected], pwdexp: 20210717141027Z}
>   tasks:
>     - debug:
>         msg: "{{ item.uid }} /
>               {{ item.mail }} /
>               {{ item.pwdexp }} /
>               {{ _date90 }}"
>       loop: "{{ warning_users }}"
>       vars:
>         _sec: "{{ (item.pwdexp[0:8]|
>                    to_datetime('%Y%m%d')).strftime('%s')|int
>                   + 90 * 24 * 60 * 60 }}"
>         _date90: "{{ '%Y-%m-%d'|strftime(_sec) }}"
>
> gives
>
>   msg: user1 / [email protected] / 20210715141027Z / 2021-10-13
>   msg: user2 / [email protected] / 20210716141027Z / 2021-10-14
>   msg: user3 / [email protected] / 20210717141027Z / 2021-10-15

YYYY-MM-DD is the very useful European standard, and is also followed
by various useful RFC's, such as RFC 3339.Might I encourage ansible
users to follow that standard as closely as possibl?

    $ date --rfc-3339=seconds
    2021-12-16 10:58:09-05:00

It also preserves the offset from GMT, which the typical casually
drummed up bit of python scripting will not.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9rzsLyFfXv1j4ywoxNhkoaCkYJiGbX-czzC-YzxD2FPW7A%40mail.gmail.com.

Reply via email to