# Compare now value with other Date in Transform rule

**URL:** <https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787>\
**Category:** SHF Discussion and Questions\
**Created:** [June 16, 2021, 1:09pm UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787 "2021-06-16T13:09:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ismaelmoreno1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ismaelmoreno1/32/2756_2.png) [@ismaelmoreno1](https://developer.sailpoint.com/discuss/u/ismaelmoreno1)\
**Post date:** [June 16, 2021, 1:09pm UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/1 "2021-06-16T13:09:37Z")

</div>

Hello,

We are triying to compare two dates using Transform rule. We need evaluate if ‘now \<= estartDate’ .The rule works when condition is ‘now \< startDate’ but we note that condition is not working when ‘now = estartDate’  
The start date in the source doesn’t contain ISO format so it always gives output as now \> startdate.

We are using the following code.

```auto

{
"attributes": {
    "firstDate": "now",
    "secondDate": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "attributeName": "startDate",
                                "sourceName": "Test IDP"
                            },
                        "type": "accountAttribute"
                        },
                    "inputFormat": "PEOPLE_SOFT",
                    "outputFormat": "ISO8601"
                    },
                "type": "dateFormat"        
            },
    "operator": "lte",
    "positiveCondition": "joiner",
    "negativeCondition": "inactive"
},
"type":"dateCompare",
"id":"Test Detect change Department Transform"
}

```

Is it necessary change date format to now value?. What is the way to evaluate the condition ‘now = estartDate’?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [June 16, 2021, 9:25pm UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/2 "2021-06-16T21:25:03Z")

</div>

Hey @ismaelmoreno1,

I am asking around internally to see if I can get some insights to your question. Please hang tight and we will circle back shortly with some answers for you.

---

<div class="post-metadata">

**Author:** ![rob\_outterson](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/rob_outterson/32/102_2.png) [@rob\_outterson](https://developer.sailpoint.com/discuss/u/rob_outterson)\
**Post date:** [June 17, 2021, 10:49am UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/3 "2021-06-17T10:49:28Z")

</div>

ismaelmoreno1,

I am not a transforms expert, so please take what I am saying with a grain of salt.

It strikes me that you are comparing a date object with a date-time object. The transform explicitly puts the date from PeopleSoft in a `dateFormat`. The transform does not specify the format for `now`, so it could be a date-time. Unless you happen to run the transform at the stroke of midnight, `now` will always be greater than `startdate`, even when the days match. That is because `startdate` has no time-of-day component, while `now` does.

You may want to look into extracting the date component from `now`, so that you are comparing just the dates.

Rob

---

<div class="post-metadata">

**Author:** ![ismaelmoreno1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ismaelmoreno1/32/2756_2.png) [@ismaelmoreno1](https://developer.sailpoint.com/discuss/u/ismaelmoreno1)\
**Post date:** [June 18, 2021, 7:56am UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/4 "2021-06-18T07:56:03Z")

</div>

Hi routters,

Thanks for your comment. I’ve tried with the following rule, but I get a DateException  
error , so, my questions is if it is possible change **now** object to format **mm/dd/yyyy**

```auto

{
"attributes": {
	"firstDate": {
		"attributes": {
			"input": {
				"attributes": {
					"input": "now",
					"inputFormat": "ISO8601",
					"outputFormat": "PEOPLE_SOFT"
				},
				"type": "dateFormat"
			},
			"inputFormat": "PEOPLE_SOFT",
			"outputFormat": "ISO8601"
		},
		"type": "dateFormat"
	},
    "secondDate": {
		"attributes": {
			"input": {
				"attributes": {
					"attributeName": "startDate",
					"sourceName": "Test IDP"
				},
                "type": "accountAttribute"
            },
			"inputFormat": "PEOPLE_SOFT",
			"outputFormat": "ISO8601"
         },
         "type": "dateFormat"        
    },
    "operator": "lte",
    "positiveCondition": "joiner",
    "negativeCondition": "rule"
},
"type":"dateCompare",
"id":"Test Detect change Department Transform"
}

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ismaelmoreno1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ismaelmoreno1/32/2756_2.png) [@ismaelmoreno1](https://developer.sailpoint.com/discuss/u/ismaelmoreno1)\
**Post date:** [June 25, 2021, 8:30am UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/5 "2021-06-25T08:30:00Z")

</div>

Hi,

Finally, I was able to compare now value with other date using the following transform rule

```auto
{
    "attributes": {
        "negativeCondition": "rule",
        "positiveCondition": "joiner",
        "firstDate": {
            "attributes": {
                "input": {
                    "attributes": {
                        "input": {
                            "attributes": {
                                "input": "",
                                "expression": "now"
                            },
                            "type": "dateMath"
                        },
                        "inputFormat": "yyyy-MM-dd'T'HH:mm",
                        "outputFormat": "PEOPLE_SOFT"
                    },
                    "type": "dateFormat"
                },
                "inputFormat": "PEOPLE_SOFT",
                "outputFormat": "ISO8601"
            },
            "type": "dateFormat"
        },
        "secondDate": {
            "attributes": {
                "input": {
                    "attributes": {
                        "attributeName": "startDate",
                        "sourceName": "Test IDP"
                    },
                    "type": "accountAttribute"
                },
                "inputFormat": "PEOPLE_SOFT",
                "outputFormat": "ISO8601"
            },
            "type": "dateFormat"
        },
        "operator": "lte"
    },
    "id": "Test Detect change Department Transform",
    "type": "dateCompare"
}

```

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [June 25, 2021, 7:08pm UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/6 "2021-06-25T19:08:27Z")

</div>

Hey @ismaelmoreno1, I am happy to hear that you were able to find the solution for this issue. Thanks again for posting and please let us know if you have any questions in the future 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:21pm UTC](https://developer.sailpoint.com/discuss/t/compare-now-value-with-other-date-in-transform-rule/787/7 "2023-07-19T14:21:53Z")

</div>


