# Date field, calculations

**URL:** <https://forum.kintone.dev/t/date-field-calculations/50>\
**Category:** General\
**Created:** [April 11, 2017, 2:39am UTC](https://forum.kintone.dev/t/date-field-calculations/50 "2017-04-11T02:39:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [April 11, 2017, 2:39am UTC](https://forum.kintone.dev/t/date-field-calculations/50/1 "2017-04-11T02:39:21Z")

</div>

Client has a need to display or calculate a date for 6 months or 1 year after an existing date value in a Date field.

Is there a way to accomplish this?

Norman

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [April 17, 2017, 4:22am UTC](https://forum.kintone.dev/t/date-field-calculations/50/2 "2017-04-17T04:22:33Z")

</div>

Hi ncheng!  
There are two ways.

1. Using&nbsp;Automatic Calculation

DATE\_FORMAT function looks good.

[https://help.cybozu.com/en/k/user/autocalc.html](https://help.cybozu.com/en/k/user/autocalc.html)

but times must be specified in seconds like this.  
DATE\_FORMAT(datetime + (60\*60\*24\*365),“YYYY-MM-dd”,“system”)

&nbsp;

1. Using Moment.js

You can do this by Using JavaScript customize.

Please see the details below.  
“Moment.js - customize date formats”  
[https://developer.kintone.io/hc/en-us/articles/115002348967](https://developer.kintone.io/hc/en-us/articles/115002348967)

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [April 17, 2017, 6:22am UTC](https://forum.kintone.dev/t/date-field-calculations/50/3 "2017-04-17T06:22:58Z")

</div>

Note that the DATE\_FORMAT function is only available for the calculation option on text fields, and that the output is text (and not in a date format).  
You can also do something similar with the Calculated field - if you input the formula _**mydatefield + (60\*60\*24\*365)**_ , this will output the date after 60 days, but in the number of seconds, like&nbsp; **1492409700**. You can change the display format for this number though to display a date format instead of this number. Note though, that this also is not actually a date (it’s just displayed as a date), so you&nbsp;won’t be able to include it in reminders.

If your main objective though is to send out reminders, you can go to the Reminder Notifications in your App Settings, Ass a new trigger, select your original date field and select “60 days after” and select a desired time. You won’t need to deal with calculated fields in this case.

If you strictly need the output as a date, I would go with Masa’s option 2 - use Moment.js.  
There’s an article explaining how to use it  
[https://developer.kintone.io/hc/en-us/articles/115002348967](https://developer.kintone.io/hc/en-us/articles/115002348967)&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [August 16, 2017, 5:07am UTC](https://forum.kintone.dev/t/date-field-calculations/50/4 "2017-08-16T05:07:58Z")

</div>

how to automatically calculate the month?

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [August 21, 2017, 8:57am UTC](https://forum.kintone.dev/t/date-field-calculations/50/5 "2017-08-21T08:57:51Z")

</div>

Hi Yuzana

Sorry, your question is a bit vague…what issue are your trying to resolve?
