# dateFormat and dateArithmetic

**URL:** <https://forum.inductiveautomation.com/t/dateformat-and-datearithmetic/6505>\
**Category:** Ignition\
**Created:** [May 16, 2013, 6:09pm UTC](https://forum.inductiveautomation.com/t/dateformat-and-datearithmetic/6505 "2013-05-16T18:09:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dropKAG](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@dropKAG](https://forum.inductiveautomation.com/u/dropKAG)\
**Post date:** [May 16, 2013, 6:09pm UTC](https://forum.inductiveautomation.com/t/dateformat-and-datearithmetic/6505/1 "2013-05-16T18:09:05Z")

</div>

NEWBIE HERE… Thanks for the assistance!

Date minus a day:  
dateArithmetic(now(), -1, “day”)

Formatting the date  
dateFormat(toDate(now()), “MMM d”)

Date minus a day plus formatting… which doesn’t work but can it?  
dateArithmetic(dateFormat(toDate(now()), “MMM d”), -1, “day”)

I did figure out a way to do this by creating a expression tag, using dateArithmetic and format string, but interested if it’s possible to nest these to get where I want.

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [May 16, 2013, 7:23pm UTC](https://forum.inductiveautomation.com/t/dateformat-and-datearithmetic/6505/2 "2013-05-16T19:23:39Z")

</div>

The reason your nested expression won’t work is that dateFormat() returns a string, and dateArithmetic() expects a Java Date as its first parameter. Try doing this:

`
dateFormat(dateArithmetic(now(), -1, "day"),"MMM d")`

This works because dateArithmetic() returns a Java Date, which is what dateFormat needs as a first parameter.
