public function toLdap($date)
{
if (!$date instanceof \DateTime) {
throw new AttributeConverterException('The datetime going to LDAP should be a DateTime object.');
}
// The number_format call is to make sure a float is properly converted to a string across all platforms.
return number_format(($date->getTimestamp() + self::SECONDS_DIFF) * self::NANO_CONVERT, 0, '.', '');
}