Active Directory AccountExpires Missmatch Delimited File EndDate

Which IIQ version are you inquiring about?

Version 8.3

Share all details related to your problem, including any error messages you may have received.

I’m trying to set the accountExpires attribute, and based my solution on the following post:

When the date is loaded from a delimited file there are instances where the accountExpires is set to the day after the date in the delimited file.

On the comments of the post this issue is also mentioned:
“I have used above code to update accountExpires in AD , Some how it is showing one day before date
Example : i have given in CSV 12/30/2024,Im getting in AD 12/29/2024 07:00:00 PM
I wanted to populate same date with 12:00:00 PM .”

Is there a way to solve this issue?

1 Like

Hi @brunoocarvalho ,

Could you please check if your AD server and Sailpoint servers are in Same time zone.

1 Like

@brunoocarvalho

The issue you’re experiencing could be due to timezone differences between your system and the Active Directory server. To fix this, you can set the hours, minutes, and seconds to the desired values (12:00:00 PM) in the Calendar instance for your date.

Try using below code

import java.time.LocalDate;
import java.time.Month;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.TimeZone;

public String getAcccountExpiresValue(String terminationDate) {
    String ldapTimeStamp = "never";

    if (null != terminationDate && !"never".equalsIgnoreCase(terminationDate)) {

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
        LocalDate currentDate = LocalDate.parse(terminationDate, formatter);
        int day = currentDate.getDayOfMonth();
        Month month = currentDate.getMonth();
        int year = currentDate.getYear();
        
        Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
        c.clear();
        c.set(year, month.getValue() - 1, day, 12, 0, 0); // your date
        long time1 = c.getTimeInMillis();
        c.set(1601, 0, 1, 0, 0, 0); // Windows epoch start
        long time2 = c.getTimeInMillis();
        long ldap = (time1 - time2) * 10000;
        
        ldapTimeStamp = Long.toString(ldap);
    }
    return ldapTimeStamp;
}
1 Like

I’m facing a similar issue. How would a timezone difference explain the dates INSIDE sailpoint (between DelimitedFile and AD apps) differing by a day?

1 Like

The Active Directory is most likely on a different time zone. Would you still keep the:

TimeZone.getTimeZone(“UTC”)

Or would you need to change it so it matches the AD time zone?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.