Previous and current date calculations

I already have the Date object ( let us say d1 )which is having the past date.
and I can get the current date anyhow using calendar instance () let us say d2).
My question is, I want to compare these 2 dates for the month, year and date. it is easy to get the current date, year and month. but I cannot use getMonth(), getDate, getYear() on the Date object, becoz they are deprecated. so, how can i get the month date and year from the date d1 ?
any help is appreciated.
u can email me the answer, [email protected]
Thank you,
Nisa.

If you only need to know if d1 is before, equal to, or after d2 you can use d2.compareTo(d1) If 0, they are equal, negative means d2 is before d1, positive means d1 is before d2.
If you need the actual month, day, or year of either date, then one way is to convet the dates to strings, pass them through a StringTokenizer and grab it's parts that way.

Similar Messages

  • Unable to get values within scope of the RowGroup(only got values using Previous and current scope value)

    Hi All,
    I already calculated a row(Add Total row) like  Gross profit within Group1 (a,b,c,d,e which are sub groups) using Previous and current scope column group values. ex: Gross Profit = a - b. (within group1)
    Gross Profit = Previous(Sum(Fields!Trans_amount.Value)) - Sum(Fields!Trans_amount.Value) in Group1
    Now, I want to get values for Net income like  Net income = a - b - c in Group1.  (OR)
    Net income = Gross  Profit - c in Group1 (Using Gross Profit textbox values using Reportitems!textbox.value). but, values different.  Since Expression got new calculation)
     Please help me.
    Thanks Advance.
    - Prem Kumar T D http://www.sharepointbasic.com/

    Hi Premtd,
    As per my understanding, there are group and subgroups in the report, you added total to a group with the expresson: Previous(Sum(Fields!Trans_amount.Value)) - Sum(Fields!Trans_amount.Value). You want to add a text box to the report to calculate Net income
    with the expression: Previous(Sum(Fields!Trans_amount.Value)) - Sum(Fields!Trans_amount.Value) - Sum(Fields!Trans_amount.Value). In order to improve the efficiency of troubleshooting, I need to ask several questions:
    • “I already calculated a row(Add Total row) like  Gross profit within Group1 (a,b,c,d,e which are sub groups)” What’s the meaning of Group1 and subgroup a, b, c, d, e ? Could you please mark Gross profit and the groups in the screenshot?
    • How to calculate Net income? Please provide some more detailed information of your requirements. I would be appreciated it if you could provide sample data and clear screenshot of the report.
    This may be a lot of information to ask for at one time. However, by collecting this information now, it will help us move more quickly toward a solution.
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu

  • User exit for Previous and current system status  for  5 transactions

    Hi Experts
    My Objective to capture the Previous and current status  of system status  for  5 transactions  in their  user exits .
    Description                                         Business Object               Transaction
    Production Order operations              BUS2005                            CO02 to edit Production Order
    Maintenance Orders                           BUS2007A                         IW32 to edit Plant Maintenance Order
    INTernal   ORDER                                 BUS2075                          KO02 to edit Internal Order
    WorkBreakdownStruct                       BUS2054                          CJ02 To edit the WBS element
    Project System Network                      BUS2002                           CN22 to edit Network
    Activities Network
    For Both Production order  and   Project System Network Activities Network    ,
    i got  User exit  "  EXIT_SAPLCOBT_001  " 
    But i am not sure whether we can use this or  not for our purpose . When i am changing status and  then saving ,  my  break point comes  to  EXIT_SAPLCOBT_001  .
    But  can we capture   JEST   or   JCDS  related  data   in that  user  exit  or  How can we capture both Previous status  and Current ( Means New changed status ) . For eg  From Released   to   Technically complete   etc.
    I want Status changed and its immedtiate previous status. 
    Do i need to check Exit  or BADI  before  and after Saving .
    Thanks
    Regards
    Gaurav
    Edited by: TheGaurav on Sep 8, 2011 10:28 AM

    Hi Himanshu
    Many Thanks for the reply . 
    I also had some other processing needs to be done on the basis of those status. .
    So do you have any idea or  how to find what all exits or BADIs  i can use for all of these 5 transactions , where
    i can get data for JCDS ( or JEST ) .
    CO02 to edit Production Order                 
    IW32 to edit Plant Maintenance Order
    KO02 to edit Internal Order
    CJ02 To edit the WBS element
    CN22 to edit Network        
    can we use   EXIT_SAPLCOBT_001  for    CO02  and  CN22   .
    Edited by: TheGaurav on Sep 8, 2011 1:21 PM

  • Historic and Current data for Master data bearing objects

    Hi All,
    We are trying to implement type 2 dimensions for all the master data bearing characteristics, where we require historic and current data available for reporting. the master data can have a number of attributes and all of them can be time dependent. We are not getting any 'datefrom' or 'dateto' from the source system.
    For example:
    For Example: The table below shows data entering BI at different dates.
    Source Data day of entering BI
    MasterID ATTR1 ATTR2
    123506 Y REWAR day1
    123506 N REWAR day4
    123506 Y ADJUST day4
    123506 N ADJUST dayn
    The field 'day of entry into BI' is only for your understanding; we do not get any date fields from the source. SID is the field we are generating for uniqueness. It is a counter. EFF_DATE would be the current date for all the data. EXP_DATE would be 31.12.9999 until the attributes change. SID and MasterID together would be the key.
    On day 1 the following data enters BI,
    day 1
    SID MasterID ATTR1 ATTR2 EFF_DATE EXP_DATE
    1 123506 Y REWAR 2/10/2009 12/31/9999
    On day 4, 2 data records enter with same PID,
    SID MasterID ATTR1 ATTR2 EFF_DATE EXP_DATE
    2 123506 N REWAR 2/13/2009 12/31/9999
    3 123506 Y ADJUST 2/13/2009 12/31/9999
    the EXP_DATE of the record of day 1 needs to be changed to current date.
    Also there are two records entering, so latest record would have EXP_DATE as 31.12.9999. And the EXP_DATE of the first record on day 4 should change to the current date.
    so the following changes should happen,
    CHANGE
    SID MasterIDATTR1 ATTR2 EFF_DATE EXP_DATE
    1 123506 Y REWAR 2/10/2009 2/13/2009
    CHANGE
    SID MasterID ATTR1 ATTR2 EFF_DATE EXP_DATE
    3 123506 Y ADJUST 2/13/2009 2/22/2009
    On day n, one data record enters with same PID,
    SID MasterID ATTR1 ATTR2 EFF_DATE EXP_DATE
    4 123506 N ADJUST 2/22/2009 12/31/9999
    The change is ,
    CHANGE
    SID MasterID ATTR1 ATTR2 EFF_DATE EXP_DATE
    3 123506 Y ADJUST 2/13/2009 2/22/2009
    The data expected in P-table is as below, on Day n or after Day n, untill any other record enters for this MasterID,
    1 123506 Y REWAR 2/10/2009 2/13/2009
    2 123506 N REWAR 2/13/2009 2/13/2009
    3 123506 Y ADJUST 2/13/2009 2/22/2009
    4 123506 N ADJUST 2/22/2009 12/31/9999
    Has anyone worked on type 2 dimensions earlier? Or any ideas to implement this logic would be appreciated.
    Regards,
    Sudeepti

    Compound the Master ID with eff date and other attribute as superior objects
    so you will get P-table as
    ATTR1   ATTR2   MAT ID  
    1 2/10/2009 2/13/2009 123506 Y REWAR
    2 2/13/2009 2/13/2009 123506 N REWAR
    3 2/13/2009 2/22/2009 123506 Y ADJUST
    4 2/22/2009 12/31/9999  123506 N ADJUST

  • How to display the username and current date in OAF  page Footer region

    Hi,
    I need to display the username and Current-Date in footer region.If anybody knows the procedure then please share with me.
    Thanks
    Divya Agarwal

    Hi,
    Read this Thread:--
    You have to capture the UserName and Date in the Process Request Method of page Controller and invoke a method which will subsequently get and set the value in some attribute.
    String userName = pageContext.getUserName();
    How to populate Current Date and Time in OAF page through CO
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Increment the version and current date in .ver file

    Hi All,
    I have the version.ver file and it looks like
    [version]
    BuildDates=2014.10.01
    Script=01
    MainVersion=1.00.00.00:01
    I want to increment the values and current date if i trigger the build using batch script. The output i need is like this
    BuildDates=yy.mm.dd (current date)
    Script=02
    MainVersion=1.00.00.00:02
    Thanks in advance

    Thanks for your reply. This is my script
    @echo off>newfile&setlocal enabledelayedexpansion
    :: set up your date here. It probably won't match my format so you'll need to adapt:
    set dt=%date:~10,4%.%date:~7,2%.%date:~4,2%
    for /f "skip=2 tokens=2,3 delims==:" %%a in ("filename") do (
    set v= %%b
    set v= !v: 0=!
    set /a v+=1
    set v=0!v!
    set v=!v:~-2!
    >>newfile echo SCRIPT=!v!
    >>newfile echo BuildDates=%dt%
    >>newfile echo MajorVersion=%%a:!v!
    goto :aa
    :aa
    more +3 "filename" >> newfile
    del "filename"
    ren newfile "filename"
    Before execute the script my file will be look like:
    version]
    BuildDates=date
    Script=09
    MainVersion=3.00.00.00:09
    after executing i am getting the output value as
    BuildDates=date
    Script=01
    MainVersion=19:01
    MainVersion=3.00.00.00:09

  • Pre-populate data and current date only when it routes to that person

    Hi,
    Can  any one please advise how to pre-populate the manager's name when it routes to the manager but not when the user fills the form.
    Example: user fills the form and submit it to the manager, the process has the query to look up for the manager to route it to him for approve/deny. How can I have the manager's name to pre-populate so he/she does not have to type their name and current date to approve/deny the form.
    Thanks in advance,
    Han Dao

    Paul,
    If I have the codes to execute the WS at the initialize event then it does populate the manager info when the user fills the form but when I try to move the code to the pre-submit event which try to execute WS when it route to the manager. I know I did not do it right but have no idea how to make it work.
    Is there a way to execute the WS when it routes to the next person rather than when the user fills the form?
    Thanks,
    Han

  • Selection based on previous run date , time and current date a

    HI all,
    I have the selection as follows.
    Previous run date :  .12/14/2005..                     previous run time-14:30:56
    current run date : 12/17/2009.                      current run time: 07:05:31
    Here all are parameters. and  current run date is system date  and   current run time is system time.
    i want to fetch all the deliveries from the above selection including previous run date and time.
    Any inputs..

    Hi
    Append current run data and previous run data into a data range parameter,Current time and previous time into time range parameter and fetch the data based on the range parameters.
    Regards
    Srilaxmi

  • Is there any standard variable to calculate previous and current month

    hi,
    Is there any standar variable to calculate previous month and current month which will calcualte from system date (sy-date). I found standard SAP Delivered variable - 0CMONTH to calculate current month. But i want both current month and previous month.  IF it is not avialble can you please provide me the ABAP code..
    thanks in advance.

    Hi,
    Check this thread.
    ABAP routine for loading previous months data in infopackage
    Regards.

  • How to reference application version number and current date in page footer

    Am new to Apex and am creating first app for production users on Apex 4.0.1 ... I notice that Application Builder app itself displays the version number at bottom right of screen .. are there any substitution strings that I can use to get current date and application version in my own Apex app ... or do I need to create e.g Javascript to format the date and create my own substitution string ?
    Any help much appreciated .. thanks !

    I modified the Footer of our Default page template. Used JavaScript for the date, below is the code we use. The very last table is specific to our environment and it would need to be customized for your use or removed if not needed. I am a JavaScript novice so this may be crude but it does the job.
    Jeff
    <table width="100%" cellpadding="0" cellspacing="0"
    border="0">
    <tr>
    <td width="500">
    <script Language="JavaScript">
    <!--
    function GetDay(nDay)
         var Days = new Array("Sunday","Monday","Tuesday","Wednesday",
                              "Thursday","Friday","Saturday");
         return Days[nDay]
    function GetMonth(nMonth)
         var Months = new Array("January","February","March","April","May","June",
                                "July","August","September","October","November","December");
         return Months[nMonth]             
    function GetTime () {
      var curtime = new Date();
      var curhour = curtime.getHours();
      var curmin = curtime.getMinutes();
      var cursec = curtime.getSeconds();
      var time = "";
      if(curhour == 0) curhour = 12;
      time = (curhour > 12 ? curhour - 12 : curhour) + ":" +
             (curmin < 10 ? "0" : "") + curmin + ":" +
             (cursec < 10 ? "0" : "") + cursec + " " +
             (curhour > 12 ? "PM" : "AM");
      return time;
    function DateString()
         var Today = new Date();
         var suffix = "th";
         switch (Today.getDate())
              case 1:
              case 21:
              case 31:
                   suffix = "st"; break;
              case 2:
              case 22:
                   suffix = "nd"; break;
              case 3:
              case 23:
                   suffix = "rd"; break;
         var strDate = GetDay(Today.getDay()) + " - " + GetMonth(Today.getMonth()) + " " + Today.getDate(); strDate += suffix + ", " + Today.getFullYear() + " " ;
         return strDate
    //-->
    </script>
    <script Language="JavaScript">
    <!--
    document.write(DateString() + GetTime());
    //-->
    </script>
    </td>
    <td width="300" class="fineprint"><div align="right">
    </div></td>
    <td width="900" class="fineprint"><div align="right">
    &APP_USER.
    #APP_VERSION#
    </div></td>
    </tr>
    </table>
    <table width="100%" cellpadding="0" cellspacing="0"
    border="0">
    <tr>
    <td width="33%" align="left" valign="bottom"><img
    src="#WORKSPACE_IMAGES#iconseal-rust.gif" alt="NH State Seal" width="25"
    height="25" /></td>
    <td  width="33%" align="center" valign="bottom"><a href="http://www.nh.gov/" class="fineprint">NH.gov</a>
      <a href="http://www.nh.gov/disclaimer.html"
    class="fineprint">Privacy Policy</a>   <a
    href="http://www.nh.gov/wai/index.html" class="fineprint">Accessibility
    Policy</a></td>
    <td width="33%" class="fineprint"><div align="right">Copyright &#169 State of
    New Hampshire, 2007-2010</div></td>
    </tr>
    </table><br />
    #FORM_CLOSE#
    </body>
    </html>

  • Logotype and Current Date in PDF - Web Applications

    Is possible to insert an image (company logotype) and a text (title and date) in PDF generate through “Printed Version” functionality? The generated PDF only contains result table of the report.
    By the way, how can I insert current date in a web application? I don’t want to use javascript because javascript would return de time/date of the end user computer.
    Thanks in advance.
    Best regards,
    Raphael Barboza

    Hi Raphael,
    Q1) Is possible to insert an image (company logotype) and a text (title and date) in PDF generate through “Printed Version” functionality? The generated PDF only contains result table of the report??
    A)In PDF Print Properties you should be able enter "Title and Date" and also When you define command sequence make sure to call "Analaysis Item only" otherwise the whole template will be downloaded to PDF. Please play with the properties when defining Command Sequence.
    Q2) how can I insert current date in a web application? I don’t want to use javascript because javascript would return de time/date of the end user computer ???
    A) Use Web Template "TEXT ITEM" and in the web item properties "LAST UPDATED or KEY DATE" is the property you should assign.
    Sorry I dont have my system as of now to send you code for these but they are pretty easy.
    thanks,
    Deepak
    SAP BI Consultant
    D N Tech

  • Consecutive Numbering and Current Date

    I am trying to create an invoice (that I will save as a template) and I want the invoice number to change, each time I open the invoice template, to the next consecutive number. I also want the date to stay current each time I open the document. Can anyone help? Thanks in advance.

    MATOS-3802 wrote:
    Thanks for the reply. I am neither familiar with computer lingo nor am I very computer savvy, so a lot of that is really confusing to me. Is there a plain English "numbers for dummies" way of going about it? Thanks again.
    Hi MATOS,
    Fortunately you don't need to understand most of it in order to use it.
    As a user, you need only understand:
    Open the Script Editor.
    Copy Yvan's script from his post, then Paste it into the Script editor.
    Then read this part (assuming your English is stronger than your French). The numbers labeling the sections are used in my notes below:
    Section 1A:
    +++++++
    Save this script as Script : invoiceWithDateAndnumber.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Note 1
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Section 1B
    menu Scripts > Numbers > invoiceWithDateAndnumber
    will create a new document from the defined user template
    and insert a new number and the current date as a fixed value.
    Section 2
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Section 3
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/06/05
    Section 4
    --=====
    property theApp : "Numbers"
    Adapter ces six “properties” à vos besoins
    Adjust these six properties to fit your needs
    property myTemplate : "my_invoice.nmbtemplate"
    property fichierNum : "the_number.txt"
    property mySheet : "1"
    property myTable : "1"
    property cell4number : "A1"
    property cell4date : "A2"
    --=====
    Section 4 is the beginning of the actual script. You will need to edit the properties list to fit your own situation.
    The first property "theApp" names the application (Numbers) that the script affects. Do not change this.
    Below the line "Adjust these...":
    myTemplate:
    Change "my_invoice.nmbtemplate" to match the name of your Invoice template, and add the ".nmbtemplate" extension to the name.
    fichierNum:
    This is the name of the file that keeps the most recent invoice number. The script will create the file the first time the script is run, and will update it each tome after that. No change is needed in this line.
    mySheet:
    myTable:
    These are currently set to use the first (ie. top of the list) Table on the first sheet of your invoice template. If the template contains only one table (and only one sheet) no change is needed. If your template contains more than one table, you may need adjust the number(s).
    cell4number:
    This is the cell in which the Invoice Number will be placed. Change "A1" to the actual location of the Invoice Number on your template. Remember to enclose the location in double quotes.
    cell4date:
    This is the cell in which the current date will be placed. Change "A2" to the actual location of the Invoice Date on your template. Remember to enclose the location in double quotes.
    In Section 1, Note 1 tells you you will need a specific set of folders in which to place the script.
    In the Finder, open a new window and click on yourAccount (the house icon with your username below it), then on Library, then on Scripts, then on Applications, then on Numbers.
    Each time you click, it opens the folder and shows (in the next column, if your Finder window is in Column view) the items in that folder. If any of the names on this path are missing, you will need to go to the File menu, choose New Folder, and give the new folder the name shown above. (If you have not yet added any scripts, you will likely need to create at least the Applications and Numbers folders.)
    Section 1A tells what to do with the script after you have edited it: Save it in the Numbers folder you created above. You can save it to the Desktop, then move it to the correct folder, or you could save it directly to the correct folder. Yvan's name is chosen to tell exactly what the script does.
    Section 1B tells how to call the script (ie. how to get it to do what it's written to do):
    go to the Scripts Menu, choose Numbers, then choose "invoiceWithDateAndnumber",
    then describes what the script does.
    The Scripts menu is likely not yet in your Menu bar, so Section 2 tells how to get it there. If you, like me, have a crowded Menu bar already, you may also have to remove something else to make room for the Scripts menu.
    Section 3 tells who wrote the script (Yvan) and when he did so.
    Once you've completed those steps (editing properties and saving the script to the correct location), creating a new dated and numbered invoice is a simple matter of choosing this script in the Scripts menu.
    Regards,
    Barry

  • Getting previous and current versions by date in RoboSourceControl

    (RoboHelp 8 with RoboSource Control 3.1) Hello, I want the ability to revert back to a previous version of my RoboHelp project (i.e. by date and/or time) and then return to the most current version of the project from source control.  I know that CVS clients have the ability to do a special update to grab a version of a checked in module by date/time, but I can't seem to see how this is done in RoboSourceControl.  I see that there is the notion of tags in RoboSource Control, which seem to allow me to roll back my codebase to a date/time based on this tag, but when I do that, I can't see how to then go back to the current version of the project.  Am I missing something here, or is that not possible with RoboSource Control?

    Actually I haven't set up the remote debug option yet, so there is no specific line to point.
    But I can clearly say that executing the method didn't create any problem.
    The problem occurs when I add the second part.
    That's why I thought that I am not following the right way to obtain the iterator by ValueExpression. So I am asking for the right expression to do it.
    Thanks.

  • Comparing LastLogonTimeStamp and current date (DateDiff)

    I am looking to modify my working vbscript to only enumerate the users not logged on in a defined variable amount of time. I tried to modify this using the function below, or any variation of, but since removed it as I was unsuccessful. The current script
    returns the lastlogontimestamp attribute without issue but I do not have experience with date comparisons. Thank you in advance for your time and assistance.
    For Each strUser In objList
    If Not objList(strUser) = #1/1/1601# Then
    If DateDiff("d", objList(strUser), Now) > 30 Then
    Wscript.Echo strUser & " ; " & objList(strUser)
    End If
    End If
    Next
    Complete script:
    'Craig
    Option Explicit
    set objFSO = CreateObject("scripting.filesystemobject")
    set objFile = objFSO.createtextfile(".\_UserAudit.txt")
    Const ADS_UF_ACCOUNTDISABLE = 2
    Dim intUAC,strStatus,strDate
    Dim objRootDSE, adoConnection, adoCommand, strQuery
    Dim adoRecordset, strDNSDomain, objShell, lngBiasKey
    Dim lngBias, k, strDN, dtmDate, objDate,objFSO,objFile,dtmPwdLastSet
    Dim strBase, strFilter, strAttributes, lngHigh, lngLow,strWhenCreated,strSAM,strpwd,stremployeetype
    ' Obtain local Time Zone bias from machine registry.
    Set objShell = CreateObject("Wscript.Shell")
    lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\" _
    & "TimeZoneInformation\ActiveTimeBias")
    If (UCase(TypeName(lngBiasKey)) = "LONG") Then
    lngBias = lngBiasKey
    ElseIf (UCase(TypeName(lngBiasKey)) = "VARIANT()") Then
    lngBias = 0
    For k = 0 To UBound(lngBiasKey)
    lngBias = lngBias + (lngBiasKey(k) * 256^k)
    Next
    End If
    Set objShell = Nothing
    'strDNSDomain="DC=DMAIN,DC=LOCAL"
    'Uncomment so it does the currnet domain it runs in
    ' Determine DNS domain from RootDSE object.
    Set objRootDSE = GetObject("LDAP://RootDSE")
    strDNSDomain = objRootDSE.Get("defaultNamingContext")
    Set objRootDSE = Nothing
    ' Use ADO to search Active Directory.
    Set adoCommand = CreateObject("ADODB.Command")
    Set adoConnection = CreateObject("ADODB.Connection")
    adoConnection.Provider = "ADsDSOObject"
    adoConnection.Open "Active Directory Provider"
    adoCommand.ActiveConnection = adoConnection
    ' Search entire domain.
    strBase = "<LDAP://" & strDNSDomain & ">"
    ' Filter on all user objects.
    strFilter = "(&(objectCategory=person)(objectClass=user))"
    ' Comma delimited list of attribute values to retrieve.
    strAttributes = "distinguishedName,samaccountname,lastLogonTimeStamp,useraccountcontrol,pwdLastset,WhenCreated,employeetype"
    ' Construct the LDAP syntax query.
    strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
    ' Run the query.
    adoCommand.CommandText = strQuery
    adoCommand.Properties("Page Size") = 100
    adoCommand.Properties("Timeout") = 60
    adoCommand.Properties("Cache Results") = False
    Set adoRecordset = adoCommand.Execute
    objFile.WriteLine "sAMAccountName;distinguishedName;lastLogonTimestamp;Status;whenCreated;pwdLastSet"
    Do Until adoRecordset.EOF
    strDN = adoRecordset.Fields("distinguishedName").Value
    strwhencreated = adoRecordset.Fields("whencreated").Value
    strsam = adoRecordset.Fields("samaccountname").Value
    stremployeetype = adoRecordset.Fields("employeetype").Value
    intUAC=adoRecordset.Fields("userAccountControl").Value
    If intUAC AND ADS_UF_ACCOUNTDISABLE Then
    strStatus="DISABLED"
    Else
    strStatus="ENABLED"
    End if
    If (TypeName(adoRecordset.Fields("pwdLastSet").Value) = "Object") Then
    Set objDate = adoRecordset.Fields("pwdLastSet").Value
    dtmPwdLastSet = Integer8Date(objDate, lngBias)
    Else
    dtmPwdLastSet = #1/1/1601#
    End If
    ' Retrieve attribute values for the user.
    'strDN = adoRecordset.Fields("samaccountname").Value
    ' Convert Integer8 value to date/time in current time zone.
    On Error Resume Next
    Set objDate = adoRecordset.Fields("lastLogonTimeStamp").Value
    If (Err.Number <> 0) Then
    On Error GoTo 0
    dtmDate = #1/1/1601#
    Else
    On Error GoTo 0
    lngHigh = objDate.HighPart
    lngLow = objDate.LowPart
    If (lngLow < 0) Then
    lngHigh = lngHigh + 1
    End If
    If (lngHigh = 0) And (lngLow = 0 ) Then
    dtmDate = #1/1/1601#
    Else
    dtmDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
    + lngLow)/600000000 - lngBias)/1440
    End If
    End If
    ' Display values for the user.
    If (dtmDate = #1/1/1601#) Then
    strDate="Never"
    Else
    strDate=dtmDate
    End If
    objFile.WriteLine strsam & ";" & strDN & ";" & strDate & ";" & strStatus & ";" & strwhencreated & ";" & dtmPwdLastSet
    adoRecordset.MoveNext
    Loop
    objFile.WriteLine "Complete"
    objFile.Close
    Function Integer8Date(ByVal objDate, ByVal lngBias)
    ' Function to convert Integer8 (64-bit) value to a date, adjusted for
    ' local time zone bias.
    Dim lngAdjust, lngDate, lngHigh, lngLow
    lngAdjust = lngBias
    lngHigh = objDate.HighPart
    lngLow = objdate.LowPart
    ' Account for error in IADsLargeInteger property methods.
    If (lngLow < 0) Then
    lngHigh = lngHigh + 1
    End If
    If (lngHigh = 0) And (lngLow = 0) Then
    lngAdjust = 0
    End If
    lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
    + lngLow) / 600000000 - lngAdjust) / 1440
    ' Trap error if lngDate is ridiculously huge.
    On Error Resume Next
    Integer8Date = CDate(lngDate)
    If (Err.Number <> 0) Then
    On Error GoTo 0
    Integer8Date = #1/1/1601#
    End If
    On Error GoTo 0
    End Function

    Why don't you switch to powershell?
    "get-aduser -filter * -properties * | ? {$_.lastlogondate -ge (get-date).adddays(-30)} | 
    select samaccountname,enabled,distinguishedname,whencreated,passwordlastset,lastlogondate | 
    sort lastlogondate | export-csv 'results.csv' -notypeinformation"
    **This is a one-liner command**
    Powershell makes it great because you can avoid the hassle of converting values.  For example, lastlogondate is a powershell property.  It's the datetime, human friendly version of the replicated logontimestamp.  The property 'lastlogon' is
    the non-replicated value, be sure to use the right one.
    The UAC bits don't need converted because PS breaks out the bits into easier to manage properties for us.  
    The {$_.lastlogondate....} filter is dynamically grabbing the accounts that have logged in within the last 30 days.  Get today.  Add -30 (30 days ago) and then go greater than that. (-30,-29,-28....today)
    Chris Ream

  • To get previous and current meter reading in Bill Doc

    Hi ALL
    To get current and previous meter readings in Bill Document,  How to fill DBERCHZ2 table.
    currently my billing scheme is not updating any line items into DBERCHZ2 to 8 tables.
    could you please suggest any one...
    Thanks in ADVANCE...........KK

    Resloved my self
    Thanks..............KK

Maybe you are looking for

  • Can connect to wireless network but no internet?

    Ok, I'm sure this is answered somewhere, but I'm tired. At this point I'm not even sure if it can be done. But... I tried to connect to my mother's wireless internet using my Airport Extreme. I connected to the wireless but was unable to access the i

  • Install OCS 10.1.2 Infra DB failed with LDAP: error code 16 on Workspaces

    during install OCS Infrastructure DB OCS have error: ... processed key-value: logfile=/oracle/product/dbocs/workspaces/logs/cw_config_backend.log ... processed key-value: action=setup_backend ... processed key-value: oh=/oracle/product/dbocs ... proc

  • Capture coverage on a DVD

    I have three long and boring DVDs of soccer games that I am supposed to edit into a little video for the soccer team banquet. This is pro bono work and technical quality is not a factor. Is there any way to capture a DVD directly into FCP. I tried co

  • Help with "Tabbed panels"

    Hi guys, i am trying to design a web for my company. The company devided in to three parts. Every part has a slightly different menu. I assume i could use "tabbed panels" for that purpose but the contents of tabs are changed only on mouse click. I wo

  • Unable to install the AIR on Samsung Galaxy Fit

    Hi, I am unable to install the Adobe Air on Samsung Galaxy Fit GT-S5670. I have adroid Version 2.2.1. Whenever i am trying to load an appilication from Adobe flex ver 4.5,I am getting error called Error occurred while installing the application: pkg: