On Fri, 22 Jul 2022 at 12:35, Marcel de Vries
<
marcel.mar...@gmail.com> wrote:
>
>
> ---
> - hosts: localhost
> tasks:
> - debug:
> var: hostvars['localhost']['ansible_date_time']['iso8601']
>
>
> ok: [localhost] => {
> "hostvars['localhost']['ansible_date_time']['iso8601']": "2022-07-22T10:28:46Z"
>
> However:
> ---
> - hosts: localhost
> tasks:
> - debug:
> var: hostvars['localhost']['ansible_date_time']['iso8601']
> register: date_time
> - debug:
> msg: "{{ ( (date_time).total_seconds() / 3600 ) | int }}"
>
> does not work.
What do you mean by "does not work"?
What do you expect to happen?
I.e. what are you trying to do/calculate?
If you need the number of second since epoch, then that is already
available as ansible_date_time.epoch_int
> This is because the difference in variable:
> "2022-07-22T10:28:46Z" must be 2022-07-22T10:28:46Z without quotes.
If
> How can I do that?
>
> --
> 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
ansible-proje...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/aa5b4d61-d541-4d15-8c33-96c8aa0bb794n%40googlegroups.com.