# Change 'a.m' to 'AM'

**URL:** <https://forum.inductiveautomation.com/t/change-a-m-to-am/84063>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 10, 2024, 6:11pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063 "2024-01-10T18:11:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 10, 2024, 6:11pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063/1 "2024-01-10T18:11:32Z")

</div>

transforming a `now()` expression using Datetime. there is no option to use the uppercase, non-dotted version of AM/PM. how do i fix this? here's my format string:

```python
dd MM Y, HH:MM a

```

normally, you'd have `%p` in Python to fix this atrocity. do i stack another transform for this?? or is there something i'm missing?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 10, 2024, 6:22pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063/2 "2024-01-10T18:22:53Z")

</div>

Try setting a different locale on the transform. The style of the AM/PM marker is a function of the locale.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 10, 2024, 6:29pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063/3 "2024-01-10T18:29:44Z")

</div>

actually, i just pulled my head out of my butt and re-read the docs. my solve was to transform the expression via script thusly:

```python
correctedTime = system.date.format(value, 'E, dd MMM Y, HH:MM a')
return correctedTime

```

our locale IS set to the correct format, it was the first thing i double-checked (thanks regardless 👍). for some reason, doing it this way just fixes the case problem. 🤷‍♂️

i was going to delete this post because i felt stupid (a regular thing), but you replied and now we're here. 😃

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 10, 2024, 6:32pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063/4 "2024-01-10T18:32:45Z")

</div>

As previously discussed, prefer expressions over scripts when possible, and this case is definitely possible. `system.date.format` and the `dateFormat` expression are both very thin wrappers over the underlying Java date formatting operations - so swap your script for a `dateFormat` expression and it should keep working _and_ be faster.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 10, 2024, 6:34pm UTC](https://forum.inductiveautomation.com/t/change-a-m-to-am/84063/5 "2024-01-10T18:34:12Z")

</div>

yeah. i just tipped to that and a heartbeat later: your post. 👍 thanks guys! 😃

for completion sake and for future numbskulls like me:

```python
dateTime(now(), 'E, d MMM Y, HH:MM a')
# yeilds: Mon, 1 Jan 2200, 2:00 PM 

```
