# Incorrect Date Returned in Ignition Code

**URL:** <https://forum.inductiveautomation.com/t/incorrect-date-returned-in-ignition-code/82551>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 30, 2023, 6:45pm UTC](https://forum.inductiveautomation.com/t/incorrect-date-returned-in-ignition-code/82551 "2023-11-30T18:45:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![italogustavoaraujo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/italogustavoaraujo/32/55235_2.png) [@italogustavoaraujo](https://forum.inductiveautomation.com/u/italogustavoaraujo)\
**Post date:** [November 30, 2023, 6:45pm UTC](https://forum.inductiveautomation.com/t/incorrect-date-returned-in-ignition-code/82551/1 "2023-11-30T18:45:34Z")

</div>

Hello Ignition Community,

I'm facing an issue with a piece of code in Ignition and would appreciate your assistance in understanding why the system is returning the wrong date. The code in question is as follows:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/4/84ea25f6327e36440779d30fe76676c934d6427c.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f61bcb095badf5d7bf95c0f9fb817363ccd41cf5.png)

The expectation is to obtain the start of September (`month = 9`), but it is returning the start of October. Can someone help me understand why this is happening and how I can correct this issue?

Thank you in advance for your collaboration!

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [November 30, 2023, 6:49pm UTC](https://forum.inductiveautomation.com/t/incorrect-date-returned-in-ignition-code/82551/2 "2023-11-30T18:49:13Z")

</div>

From the documentation:

> January is 0 and December is 11

---

<div class="post-metadata">

**Author:** ![italogustavoaraujo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/italogustavoaraujo/32/55235_2.png) [@italogustavoaraujo](https://forum.inductiveautomation.com/u/italogustavoaraujo)\
**Post date:** [November 30, 2023, 6:54pm UTC](https://forum.inductiveautomation.com/t/incorrect-date-returned-in-ignition-code/82551/3 "2023-11-30T18:54:47Z")

</div>

Thankyou

**getDate(year, month, day) → Date**

Creates a new Date object given a year, month, and day. Time is set to midnight.

**Parameters:**

**int year** - The year for the new date

**int month** - The month for the new date. January is month zero.

**int day** - The day of the month for the new date. The first day of the month is day 1.

**Returns:**

A new Date object on midnight of the given day.
