# Now() function in AWX

**URL:** <https://forum.ansible.com/t/now-function-in-awx/3163>\
**Category:** Get Help\
**Tags:** awx, ee\
**Created:** [January 4, 2024, 4:58pm UTC](https://forum.ansible.com/t/now-function-in-awx/3163 "2024-01-04T16:58:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 4, 2024, 4:58pm UTC](https://forum.ansible.com/t/now-function-in-awx/3163/1 "2024-01-04T16:58:38Z")

</div>

Getting some weird behavior from the `now()` function under AWX 22.6.0, ee 2.14.7. A template with the following:

```auto
Generated {{ now(fmt='%a %Y-%m-%d %I:%M%p', utc=false) }}

```

produces the correct “local” time from the CLI (also 2.14.7), but under AWX it produces UTC times. `utc=false` is the default; I only added that in an attempt to get local times. It made no difference. The time stamps AWX puts on the tasks in the job log are local. (Or at least they are displayed as local times in the GUI; trying not to assume too much!)

This isn’t urgent, just annoying. We’re planning to upgrade our AWX Real Soon Now, and bump up to later execution environments. I can live with the 5 hours difference until then. (We’re on the U.S. east coast: EST.) Maybe these planned upgrades will magically fix it.

Or, maybe we’ve got something set wrong (or unset?) in our EE. If you know of a quick fix or something to check, I’d love the hear about it. Thanks.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [January 4, 2024, 9:03pm UTC](https://forum.ansible.com/t/now-function-in-awx/3163/2 "2024-01-04T21:03:47Z")

</div>

Ouch. I got a follow-up from our AWXpert (see what I did there). He said:

> this happens because the AWX containers have their timezone set to UTC, which we can’t change. So even though you are setting `utc=false` , the local time is already UTC.

Surely there’s more to the story. The `now()` function is sweet, clean, and needed. Please don’t tell me it works everywhere except where it counts: in production in AWX. (I’m going to go have a sad.)

---

<div class="post-metadata">

**Author:** ![sirjaren](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sirjaren](https://forum.ansible.com/u/sirjaren)\
**Post date:** [January 5, 2024, 11:36pm UTC](https://forum.ansible.com/t/now-function-in-awx/3163/3 "2024-01-05T23:36:12Z")

</div>

You can certainly change the timezone in your Execution Environments.  
You can set environment variables in AWX Operator to set:

```shell
TZ=America/Chicago

```

Which could be applied to AWX Operator, eg:

```yaml
ee_extra_env: |-
  - name: TZ
    value: America/Chicago

```

Or if you are using localtime via `/etc/localtime`, you could do something like:

```yaml
ee_extra_env: |-
  - name: TZ
    value: :/etc/localtime

```

As long at that file exists and is set correctly to your intended timezone (usually a symlink).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [February 4, 2024, 11:36pm UTC](https://forum.ansible.com/t/now-function-in-awx/3163/4 "2024-02-04T23:36:43Z")

</div>

Closed on February 4, 2024, 11:36pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
