# Ansible windows

**URL:** <https://forum.ansible.com/t/ansible-windows/27428>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [May 2, 2018, 2:21pm UTC](https://forum.ansible.com/t/ansible-windows/27428 "2018-05-02T14:21:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![belajzus](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@belajzus](https://forum.ansible.com/u/belajzus)\
**Post date:** [May 2, 2018, 2:21pm UTC](https://forum.ansible.com/t/ansible-windows/27428/1 "2018-05-02T14:21:22Z")

</div>

Hi,

I’m trying to filter files newer than some other file.

So, I list that file, get his creationtime, after that I calculate the difference between the current time and the creation time of that file. That is the difference in days between today and day when the file is created.

BUT, I work with fucking windows, and, there I got epoch with comma, not dot. And I’m unable to calculate difference. If I try to get int valčue from epoch, calculated value is zero.

For example, this is output of setup module on windows:

“ansible\_date\_time”: {  
“date”: “2018-05-02”,  
“day”: “02”,  
“epoch”: **“1525275022,0416”,**

My idea was to calculate before how much day file was created with following formula:

days\_since\_last\_backup: “{{ ((current\_epoch|int - item.creationtime|int)/86400)|int }}”

But I got negative value since ansible can’t calculate integer value from some variable which has comma in self.

So, is there some option to replace in variable/string comma with dot.

---

<div class="post-metadata">

**Author:** ![Karol\_Czeryna](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@Karol\_Czeryna](https://forum.ansible.com/u/Karol_Czeryna)\
**Post date:** [May 2, 2018, 2:36pm UTC](https://forum.ansible.com/t/ansible-windows/27428/2 "2018-05-02T14:36:02Z")

</div>

hint: use replace filter 🙂 (To replace comma into dot)

{{ variable | replace(‘,’,’.’) }}

Probably you’ll need to use set\_fact as well.

Best,  
Karol

---

<div class="post-metadata">

**Author:** ![belajzus](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@belajzus](https://forum.ansible.com/u/belajzus)\
**Post date:** [May 2, 2018, 2:55pm UTC](https://forum.ansible.com/t/ansible-windows/27428/3 "2018-05-02T14:55:42Z")

</div>

Thank you Karol…

For now I solve this issue using python slicing. That was my backup option.  
But it is pretty weird that Ansible can’t work with a comma in creationtime instead of a dot.

Dana srijeda, 2. svibnja 2018. u 16:36:09 UTC+2, korisnik Karol Czeryna napisao je:
