I want to compare two date times and get the difference in seconds. Op vrijdag 22 juli 2022 om 13:14:16 UTC+2 schreef [email protected]:
> On Fri, 22 Jul 2022 at 12:35, Marcel de Vries > <[email protected]> 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 [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/aa5b4d61-d541-4d15-8c33-96c8aa0bb794n%40googlegroups.com > . > -- 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/2d219300-d418-411b-8b6c-154422918235n%40googlegroups.com.
