Converting a Date value from UKG into Long Integer custom attribute in AD

I have a custom AD attribute called startDate and it is defined as a Long Integer in AD.

I want to send the employees last hire date into the starDate attribute.

Is there way to convert the value Employment.LastHireDate into a Long Integer?

Yes there is. You can convert the DateTime value into a long integer by passing it with DateTime.ToFileTime()

This will convert the DateTime value to a long integer, that can then be stored in your custom field.

Actually a slight modification, because Employment.LastHireDate is a nullable DateTime, you will need to first check for a null before trying ToFileTime.

The full expression you can use is:

(Employment.LastHireDate != null)? Employment.LastHireDate.GetValueOrDefault().ToFileTime(): null