# Confusing results from system.date.isBefore

**URL:** <https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392>\
**Category:** Ignition\
**Tags:** scripting, ignition81\
**Created:** [March 9, 2026, 1:27pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392 "2026-03-09T13:27:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cassidy.marquis](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cassidy.marquis](https://forum.inductiveautomation.com/u/cassidy.marquis)\
**Post date:** [March 9, 2026, 1:27pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/1 "2026-03-09T13:27:38Z")

</div>

The project I am working on currently uses the system.date.isBefore() function to validate dates, however some of the results are not making sense:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/785646431d8068f1f7c2960c27e95feb9153c259.png)

It seems to return false for any date after/including 02/10/2026.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 9, 2026, 1:31pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/2 "2026-03-09T13:31:49Z")

</div>

> [@cassidy.marquis](#):
>
> It seems to return false for any date after/including 02/10/2026.

Do you mean 2nd of October 2026 (every other country on earth’s date format), or 10th of Feb 2026 (US-only date format) ?

The issue is that the month in getDate starts from 0 = Jan. I will _never_ stop being caught by this… it makes 0 sense, but it’s Java that's wrong, not Ignition. I guess the getDate function could fix it… too late now though 🙄

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 9, 2026, 1:43pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/3 "2026-03-09T13:43:46Z")

</div>

> [@nminchin](#):
>
> it makes 0 sense

I think the sense is that the month is frequently converted to a string representation, _Jan, Feb, Mar, etc._. This and translations require a lookup and, being programmers, our arrays are zero-based (so yes, zero-sense).

@cassidy.marquis , try this in Script Console.

```python
a = system.date.getDate(2026, 03, 06)
b = system.date.getDate(2026, 01, 06)
n = system.date.now()
a
b
n

```

---

<div class="post-metadata">

**Author:** ![Brian\_Seater](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brian_seater/32/82110_2.png) [@Brian\_Seater](https://forum.inductiveautomation.com/u/Brian_Seater)\
**Post date:** [March 9, 2026, 1:45pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/4 "2026-03-09T13:45:28Z")

</div>

As Nick pointed out, `getDate()` starts at 0 for the month.

[system.date.getDate() Docs](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-date/system-date-getDate)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/05def77faf0c29c76366ab5b318f25b4ed13c619.png)

When dealing with dates, I prefer to use `system.date.parse()` and explicitly specifying the format I expect. Between 0 based indexing and US/everyone else formats, it can be too ambiguous otherwise.

This is also a good example of intermediate variables and printing being your friend. Get the date, then print it to make sure it was parsed as you expected.

```python
now = system.date.now()
firstDate = system.date.getDate(2026, 03, 06)
secondDate = system.date.getDate(2026, 01, 06)

print "Now:", now

print "\nFirst date:", firstDate
print " Before now?", system.date.isBefore(firstDate, now)

print "\nSecond date:", secondDate
print " Before now?", system.date.isBefore(secondDate, now)

###
# parse() example
checkDate = system.date.parse("1/6/26", "MM/dd/yy")
print "\n\nParse date:", checkDate

```

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

---

<div class="post-metadata">

**Author:** ![cassidy.marquis](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cassidy.marquis](https://forum.inductiveautomation.com/u/cassidy.marquis)\
**Post date:** [March 9, 2026, 2:40pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/5 "2026-03-09T14:40:36Z")

</div>

> [@Transistor](#):
>
> ```python
> a = system.date.getDate(2026, 03, 06)
> b = system.date.getDate(2026, 01, 06)
> n = system.date.now()
> 
> ```

I definitely should’ve specified, I meant 10th of Feb 2026. I didn’t realize it used 0 for Jan, although I suppose that makes sense. Thanks!

---

<div class="post-metadata">

**Author:** ![cassidy.marquis](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cassidy.marquis](https://forum.inductiveautomation.com/u/cassidy.marquis)\
**Post date:** [March 9, 2026, 2:42pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/6 "2026-03-09T14:42:41Z")

</div>

Mon Apr 06 00:00:00 EDT 2026  
Fri Feb 06 00:00:00 EST 2026  
Mon Mar 09 10:39:05 EDT 2026

Well at least its an easy fix 😅 , thank you!

---

<div class="post-metadata">

**Author:** ![cassidy.marquis](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@cassidy.marquis](https://forum.inductiveautomation.com/u/cassidy.marquis)\
**Post date:** [March 9, 2026, 2:46pm UTC](https://forum.inductiveautomation.com/t/confusing-results-from-system-date-isbefore/114392/7 "2026-03-09T14:46:59Z")

</div>

Very good advice, will be using. Thank you so much!
