Convert java date to 18 dgit LDAP date -


we have requirment need insert accountexpires date in active directory. , ad take input date large integer (18 digit ldap date). have date in format yyyy-mm-dd (for ex : 2014-04-29) , want convert java date ldap date 18 digit format i.e (130432824000000000).

please let me know work around convert below format , populate ad curre nt date format.

this solution using joda time, according definition found here:

the timestamp number of 100-nanoseconds intervals (1 nanosecond = 1 billionth of second) since jan 1, 1601 utc.

sample code:

public final class foo {     private static final datetime ldap_start_date         = new datetime(1601, 1, 1, 0, 0, datetimezone.utc);      public static void main(final string... args)     {         final datetime = datetime.now();         final interval interval = new interval(ldap_start_date, now);         system.out.println(interval.todurationmillis() * 10000);     } } 

replace now in code date , should set.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -