Incorrect Date Returned in Ignition Code

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

image

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!

From the documentation:

January is 0 and December is 11

4 Likes

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.