In another thread, I was explaining how I’m getting a user’s information from our IPA server. I believe that the password expiration is already in a datetime format. I’d like to display it to the user via email in a more standard format.
For example, let’s say that the user’s password expiration date/value is 20210715141027Z. In the email I send out to them, I’d like to show 07/15/2021. Then, I’d like to calculate the date where their account will be automatically disabled, which should be 90 days after the expiration date. But I can’t figure out how to add 90 days to the expiration date.
I would try strftime('%m/%d/%Y') provided you are happy with dates in the first
12 days of each month being highly ambiguous for an international audience.
I suggest you change the format to year, month then day. This format sorts naturally when you use ls(1).
(The command in vi(1) is :!cp -p % %.211216 (or whatever is the current date).)
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.