Issue #176 has been updated by Frederic Soulier.

better formatting :
<pre>
 /**
         * Return the accountexpires time in microsoft format
         *
         * @param expireDate the date in yyyy-MM-dd format
         * @return the date in microsoft AD format
         * @throws ParseException 
         */
        public static long getAccountExpires(String expireDate) throws 
ParseException {
                if (expireDate == null || expireDate.length() == 0) {
                        return 0;
                }

                long laccountExpiresAdjust = 116444736000000000L;  // adjust 
factor for converting it to java
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                long accountExpiresTimeStamp = sdf.parse(expireDate).getTime();
                long accountExpiresTimeStampMs = accountExpiresTimeStamp * 
(long) Math.pow(10, 4);

                return (long) (accountExpiresTimeStampMs + 
laccountExpiresAdjust);
        }

</pre>



----------------------------------------
Bug #176: add function getAccountExpires to AD.class
http://tools.lsc-project.org/issues/show/176

Author: Frederic Soulier
Status: New
Priority: Normal
Assigned to: 
Category: Core
Target version: 1.2.0


Allow lsc to insert an expire date time in Active Directory using simple String 
date format like yyyy-MM-dd  



/**
         * Return the accountexpires time in microsoft format
         *
         * @param expireDate the date in yyyy-MM-dd format
         * @return the date in microsoft AD format
         * @throws ParseException 
         */
        public static long getAccountExpires(String expireDate) throws 
ParseException {
                if (expireDate == null || expireDate.length() == 0) {
                        return 0;
                }

                long laccountExpiresAdjust = 116444736000000000L;  // adjust 
factor for converting it to java
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                long accountExpiresTimeStamp = sdf.parse(expireDate).getTime();
                long accountExpiresTimeStampMs = accountExpiresTimeStamp * 
(long) Math.pow(10, 4);

                return (long) (accountExpiresTimeStampMs + 
laccountExpiresAdjust);
        }



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://tools.lsc-project.org/my/account
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-dev mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-dev

Reply via email to