How to get (old)previous date and create a loop?

Hi!!!
I am using java.util.date object.
I need to get the 2 months back date,i.e. 60 days back date and to create a loop from that date till today and add it to combobox.
Suppose today's date=3-12-2001
x=date-60=3-10-2001
and wants to create a loop from 3-10-2001 till today to display it in a combobox.
Please tell me how can I do it?

try the below which will print the date form 60 days before(from today) to todays date
import java.util.Calendar;
import java.util.Date;
public class RandomNumber
     public static void main(String args[])
          RandomNumber rn = new RandomNumber();
          rn.printDate();
     public void printDate()
          Date todayDate = new Date(System.currentTimeMillis());
          Calendar calendar_ = Calendar.getInstance();
          calendar_.setTime(todayDate);
          calendar_.add(Calendar.DAY_OF_YEAR, -60);
          for(int i=0;i<60;i++)
               System.out.println(calendar_.getTime());
               calendar_.add(Calendar.DAY_OF_YEAR, 1);

Similar Messages

  • How to get both OTF data and spool at a time

    Hi Experts,
        My requirement is to get both OTF data and spool.
    In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    I was able to get OTF data but spool is not getting generated.
    IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
    when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    the spool is generation is getting supressed.
    Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
    The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
    Please suggest me how to get both OTF data and spool at a time.

    Hi Kartik,
    This one is similar to my question to print and email invoice at same time.  I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
    Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
    itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
    Can you give me a working example that you have otfdata table and print data from that table.  I also post my question on other thread
    submit report and export to memory
    thanks

  • How to get the client date and time ?

    Dear Sirs...
    Using jdeveloper 10.1.2.0
    How can i get the client date and time using the HttpServletRequest ?
    thanks for any help in advance
    best regards

    If your code is running on the client pc you can just create a new instance of the java.util.Date class. That class automatically defaults to the current time of the client machine. Otherwise if you're running the code on the server, you could insert/post the client date/time by adding its string representation as a parameter to the HTTP request object.
    Ronald

  • How to get last modified date and time of a file which is in apache server.

    Hi ,
    I need to get last modified date and time of a file in remote machine.
    This file is in remote machine which has apache server installed.
    I am trying to get this information by connecting to apache server from client by giving absolute URI of the file to file object.
    URI is got from apache server URL by using toURI method.
    when I use lastModified method , its throwing exception , because scheme of URI is not file.
    I can't give scheme as file because ftp server is not installed on that server
    Is there any other way to get this information .

    No, unless you can use an FTP client.

  • How to get the current date and compare dates

    hi
    does anyone know how you would get the current date?
    furthermore, how to compare the current date with a past date to see how many days or months have past since then?
    thanks

    have a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.

  • How to get local file date and time ( 10g version )

    Hi,
    Would like to ask if there is any way to get the date and time of a local file. It seems that webutil does not have this function.
    And I want to use client_host ( dir c:\file.txt > c:\temp.txt ) and the read this file to get the file date.
    But the problem is the file date and time ( in the dir ) varies in different PCs.
    Best Regards,
    Ivan

    But the problem is the file date and time ( in the dir ) varies in different PCs.
    You mean the format of the date and time don't you?
    If so you maybe could create a java bean which does that for you using the lastModified Method of the File class.
    regards

  • How to get month last date and first date without FM's

    Hi Guru's,
       How can we get  month's first date and last date based on the date given in selection screen without FM's?Is it possible ?
    Like if i give 05-Oct-2008 in the selection screen, i should get the output as 01-Oct-2008 to 31-Oct-2008.Without FM's???
    Regards
    Rakesh.

    Hi Rakesh,
    You can implement this logic as follows:
    You can have two internal tables, one containing the days as numbered 31, 28, 31, and so on with the month number. This holds good if the year is a common year. Another internal table contains days as numbered 31, 29, 31 and so on with the month number. This year would be a leap year.
    An year can be calculated depending on the conditions:
    Say date is given as 20081008
    Concatenate 20081001 + 0(4) into l_date.
    Divide l_date by 4 and remainder should be equal to 0.
    Divide l_date by 400 and remainder should also be equal to 0.
    Then the dominical year will be a leap year.
    Now, if l_date divided by 100 and the remainder is 0 then the year is a common year.
    So depending on this populate the first date and last date from the respective internal table
    Regards,
    Sumalatha N.

  • How to get the previous data?

    Hi,
    I am monitoring a one moving point with coordinates (Xd,Yd). I want to get the two previous data so that I can calculate the point of origin as (Xo,Yo). I made a calculation that if i have three known points I will be able to get the point of origin. The variable data for the moving point (Xd,Yd) i showed using a slide bar. I want to see in the graph the moving point with the line connected to the point of origin at least.
    But my problem is how can i get the two previous data correctly. Can somebody kindly teach me please.
    Thank you very much.
    Attachments:
    moving point.vi ‏39 KB

    Hi Bong,
    I couldn't open your VI 'cause I'm still running LV7.11... anyway, if I understood what you're asking for, it is quite simple, you just need to drag down the shit register of the for loop as in the attached example SR.vi.
    If you are not using a shit register to plot your data, then it depends on which display you use, but there are some tricks to get previous data... but in my opinion keeping a cluster with (X,Y) in a shift register is a good idea
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    SR.vi ‏19 KB

  • How to get the current data and time of SCOM server via SCOM SDK (API) calls?

    Hi,
    I need to read the current date and time of SCOM server via SOM SDK.
    Is there a class in SDK that provides this info ?
    Thanks,
    satheesh

    To get time and date of Alerts of SCOM, You can use following command let "get-scomalert"
    Also, You can refer below links
    http://blog.tyang.org/2013/02/21/using-scom-2012-sdk-to-retrieve-resource-pools-information/
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • How to get current system date and store in db

    may i know how to get the current system date so that i can store it into the database

    java.util.Date is NOT deprecated, just most of its methods are.
    Use
    new java.sql.Date(System.currentTimeMillis());to get the current date. Note that the date in a client machine
    may differ from the clock of the server!
    BTW: java.sql.Date extends java.util.Date.
    Fritz

  • How to get  xml Element , data and its Childs

    hi,
    I am trying to get entire Element and its childs depending on condition.
    suppose
       if(doc.element.name== "despatch"){
                   // here i want entire despatch element with data and childs and copy into one string like
                   // eg: String dsp = <despatch><name>body1</name> <value>value1<value>
    </despatch>
    <?xml version="1.0">
    <handler>
         <name>header1</name>
         <value>value1</value>
    </handler>
    <despatch>
         <name>body1</name>
         <value>value1<value>
    </despatch>
    <gov>
         <name>env</name>
         <value>value1</value>
    </gov>I managed to get number of elements depending on the Element name but i need to get the entire block.
    nodeList = document.getElementsByTagName("despatch").item(0).getChildNodes();
                        for(int i=0;i<nodeList.getLength();i++){
                             System.out.println("i :"+document.getElementsByTagName("m:Security").item(i));
                        }any kind of help is appreciated.
    Han.
    Edited by: HANRAM on Apr 24, 2008 2:48 AM

    Hi Kartik,
    This one is similar to my question to print and email invoice at same time.  I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
    Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
    itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
    Can you give me a working example that you have otfdata table and print data from that table.  I also post my question on other thread
    submit report and export to memory
    thanks

  • How to get sql query data and write into csv file?

    I am writing to seek help, in how can I create bat. script which can execute the following logic:
    connection to the database
    run sql query
    create CSV file
    output query data, into CSV file
    save the CSV file
    osql
    -S 84.18.111.111
    -U adw
    -P rem
    -i "c:\query.sql"
    send ""
    sed -e 's/,\s\+/,/g' MCI_04Dec2014.csv > localNoSpaces.csv
    -o "c:\MCI_04Dec2014.csv"
    This what i have so far, and I am little struggling with the logic after creating CSV file. I am unable to get the above script to work, please advice further, where I may be going wrong. 
    Can you create if statement logic within window's script, to check for null parameters or data feeds?
    Any hints would be most appreciated. 

    Thank you for your reply. 
    Apology for posting the code irrelevant to the forum, as I am still novice scripting user.  
    My goal is to create window's script which can compute the above logic and send the final output file (csv), to FTP folder. 
    Can this logic be implemented via bat. script, if so, is there a example or tutorial i could follow, in order to achieve my task. 
    Any help would be much appreciated. 

  • How to get the system date and time using java

    hi,
    I want system date in my out put. how to access system date. can v use utill packaegs (or) sql. which one is the best to get.
    Thanks & Regards,
    Kenny.

    import java.util.Date;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    public class MyClass {
    public void setTimeStamp() {
    int hour, minute, second, time = 0;
    Date dt=new Date();
    System.out.println(dt.getDate());
    System.out.println(dt.getMonth());
    System.out.println(dt.getYear());
    Calendar cal = new GregorianCalendar();
    hour = cal.get(Calendar.HOUR_OF_DAY);
    minute = cal.get(Calendar.MINUTE);
    second = + cal.get(Calendar.SECOND);
    System.out.println (hour + ":" + minute + ":" + second);
    public static void main (String args[]){
    MyClass app = new MyClass();
    app.setTimeStamp();
    }

  • How to get the previous month and year accordingly

    Hi friends,
    I wanted to select month as number like 4 and year as 2011
    but I want to select the previous month as of sysdate
    like if the sysdate is 10-jun-2011
    it should give me 5 as month and
    in the year it should give as 2011
    if the sysdate is 01-jan-2012
    the month should be as 12 and year should be as 2011
    thanks

    Hi,
    776317 wrote:
    thanks a lot I just dont need the 0 being prefixed... can you pls tell how to avoid that as well pls
    TO_CHAR ( ADD_MONTHS (SYSDATE, -1)
            , 'FMmm yyyy'
           )For details about how the FM modifier works, wee the SQL Language manual:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements004.htm#sthref456

  • How to get  only latest date and other columns from table

    Hi,
    Table
       id          name        date
      123        a             2/3/2010
      124        b            15/2/2010
      125        c             1/1/2010
      123        a             12/4/2010
      125        c             17/2/2010
    this is a table, here id,name,date is composite key.
    I want to select id,name and date so that latest date (e.g., for id 123 date 12/4/2010 be selected) is selected for each id and each id and name should be selected once.
    So what will be its query?
    Thanks

    Hi,
    user12222356 wrote:
    SQL> select id id,name name,max(dt) over 0 from temp2;
    select id id,name name,max(dt) over 0 from temp2
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expectedWhat is over 0?That should be
    ... OVER ( )with a pair of parentheses.
    Almost all aggregate functions (including MAX) also have analytic counterparts. The parser knows that you're using the analytic version if the keyword OVER, followed by an analytic clause in parentheses, comes after the argument. In this case, the default analytic clause is being used, so there's no need to put anything in the parentheses, but syntax still requires that they be there.

Maybe you are looking for

  • Logic for FIFO in ALV o/p

    Hi I have o/p like this, which I want to display in FIFO method Material - Total Qty - Qty in store - Qty in Elctronics - Qty in Mechanical - Delivered Qty SPDEW - 5 - 1 - 2 - 2 - 0 like this -  (here Sr. no. is manually entered not from sap table fi

  • Photoshop CS3 Extended "Not Responding" after selecting horizontal type tool.

    Hello, When I start my PhotoShop CS3 Extended v10.0 and load up a jpg and then zoom in and go select the horizontal type tool and click on my jpg, PS just freezes and then I click the main screen and then it tells me infinetly that it has "Stop Respo

  • Apps wont download on my mac or iphone

    whenever i try to update or download an app on my phone AND any computer it tells me "Cannot connect to iTunes store". I already went to apple and they did nothing.. all they did was tell me to restore my iphone... does anyone know whats wrong? its g

  • Photo Recovery problem

    Hi, had all my photos sync'd to my iPhone but Dell system crashed. Bought an iMac and cannot get the photos off the iPhone into iPhoto. There pictures are in Photo Library and in folders within Photo Albums but the sync wants to erase all my photos o

  • Calling Oracle Standard Form from OAF page - Need to hide the find screen.

    Hi all, i have a requirement where i need to call a oracle standard form(D2K form) from OAF page and need to pass parameter. Now i can able to call a form from page on button click using the following syntax, "form:AR:US_AR_SUPER_USER:STANDARD:AR_ARX