I know there are a lot of threads and stuff out there, but haven't been able to find a solution to my problem. It seems to be an issue with the timezone of the input value:
I'm trying the following:
set_fact:
converted: "{{ ('20290422210804Z' | to_datetime('%Y%m%d%H%M%S%Z')) }}"
I've also tried %z as I've seen in some python-related threads mention the different case, but they both return the error:
time data '20290422210804Z' does not match format '%Y%m%d%H%M%S%Z'
If I remove the tailing 'Z' from the input and the %Z from the to_datetime function, it works fine. I only have a problem when I have the timezone identifier at the end.
I'm getting the input value from a file, so I don't have a whole lot of control over the input format, unless I take the extra step to parse out the timezone, which I prefer not to do.
Any suggestion?