GregorianCalendar Win32Epoch = new GregorianCalendar(1601,Calendar.JANUARY,1);
Date Win32EpochDate = Win32Epoch.getTime();
//Note that 1/1/1601 will be returned as a negative value by Java
GregorianCalendar Today = new GregorianCalendar();
Date TodaysDate = Today.getTime();
long TimeSinceWin32Epoch = 10000 * (TodaysDate.getTime() - Win32EpochDate.getTime());
Calendar c=new GregorianCalendar();
c.add(Calendar.DATE, 30);
Date dateAfter30Days=c.getTime();
long TimeAfter30DaysSinceWin32Epoch = 10000 * (dateAfter30Days.getTime() - Win32EpochDate.getTime());
searchFilter = "(&(objectClass=User)(accountExpires>=" + TimeSinceWin32Epoch + ")(accountExpires<="+ TimeAfter30DaysSinceWin32Epoch+"))";