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 {@code attributeType},
  3.  * converts the attribute value specified by {@code attributeType}
  4.  * to a {@code Date} and returns the date; otherwise returns {@code null}.
  5.  *
  6.  * @param attributeType
  7.  * The attribute type whose value will be converted
  8.  * to a {@code Date}; must not be {@code null}.
  9.  *
  10.  * @return attributeType's value as a {@code 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.