Posted By

ff1959 on 08/15/13


Tagged

ldap


Versions (?)

Convert LDAP attribute generalizedTimeSyntax to Date


 / Published in: Java
 

Use UnboundID LDAP SDK entry.getAttributeValueAsDate()

  1. /**
  2.  * If the entry has the attribute [email protected] attributeType},
  3.  * converts the attribute value specified by [email protected] attributeType}
  4.  * to a [email protected] Date} and returns the date; otherwise returns [email protected] null}.
  5.  *
  6.  * @param attributeType
  7.  * The attribute type whose value will be converted
  8.  * to a [email protected] Date}; must not be [email protected] null}.
  9.  *
  10.  * @return attributeType's value as a [email protected] Date}.
  11.  */
  12. private Date getTime(String attributeType) {
  13. return entry.hasAttribute(attributeType)
  14. ? entry.getAttributeValueAsDate(attributeType)
  15. : null;
  16. }

Report this snippet  

You need to login to post a comment.