How to use the method calendar.getTimeInMillis() and setTimeInMillis(bb)

I have met some problems in writing my programme,I want to know what the time is after every 20 minutes so have written some codes as below ,but the compilar warned me that there are some errors in them ,and I don't know how to use them correctly ,can you help me?
Thank you very much!
the code is:
begin=datime+" 00:00:00";
Calendar calendar=Calendar.getInstance();
DateFormat df = DateFormat.getDateInstance();
Date start=df.parse(begin);
calendar.setTime(start);
long aa=calendar.getTimeInMillis();
calendar.setTimeInMillis(aa);

Hopefully the following snippet of code will help you out (note that the Date class seems more appropriate for what you need to do):
import java.util.*;
import java.text.*;
      String begin="00:00:00";
      SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
      df.setTimeZone(TimeZone.getTimeZone("GMT"));
      Date start=new Date();
      try {
         start=df.parse(begin);
      } catch (Throwable e) {
         System.out.println("Invalid time format");
      long aa=start.getTime();   // to get the time in milliseconds
      System.out.println(aa);    // just to see what the answer is (should be zero)
      start.setTime(aa);         // to set the time in milliseconds
...V.V.

Similar Messages

  • How to use the method "getChildrenRemoved()" declared in ElementChange?

    How to use the method "getChildrenRemoved()" declared in DocumentEvent.ElementChange?

    I have tried to use it,but the code below alway say "Yes"....
    I really have no ideas about why ec is always a null.
    public void removeUpdate(DocumentEvent ee) {
           DocumentEvent.ElementChange ec = ee.getChange(doc.getDefaultRootElement());
           if(ec == null)
              System.out.println("Yes");
                     }

  • How to use the method for field-exit to trigger the workflow?

    Dear all,
         I want the workflow to trigger , when ever the check box for DELIVERY COMPLETED is checked in ME22N .
         I have developed a method in SE18 for the corresponding field and defined function module SWE_EVENT_CREATE with BOR bus2012 and event CHANGED.
        Now how to use this method to make my workflow to trigger?Shall I create an event in delegated bus2012 and can I call this method?
    Thanks and regards,
    S.Suresh

    Hi
    You want to place your method which is defined for particular filed.right?
    For that you can go for BADI. First you check whether any badi is getting called form that tcode ME22N. Then to place your method, implement that BADI.  So whenever that BADI is getting called, it will call your event. Through Event workflow will be getting triggered.
    Regards,
    Hemalatha.

  • How to use the method getParameterValues() of request object in JSP?

    I'm trying to use the method
    String a[]=request.getParameterValues("ch_box");
    to retrieve the values from the form
    but it gives the error
    "Method getParamaterValues(java.lang.String) not found in interface javax.servlet.http.HttpServletRequest."
    so plz tell me how to overcome this hurdle?
    thanx

    Well, just one note... either you have a typo in your code, or else in your post.
    If you cut and pasted the error message (which it looks like you did), then the method getParamaterValues() should be getParameterValues() instead (notice the spelling difference), so you probably just have a typo in your code.

  • How to use the portal Calendar

    Hi,
    I want to post a calendar of events for my portal users and I'm looking for documentations or tutorial in using the portal calendar feature.
    Thanks,
    Leonard

    hi leonard,
    there are 2 samples in the PDK for a lotus notes calendar portlet and a microsoft exchange calendar portlet. you can access them at portalcenter.oracle.com - PDK - Samples.
    another possibility would be to use the calendar portlet that is provided by the portlet builder. in you portal go to the navigator - providers - locally built providers - example applications: there you find a sample of a calendar portlet. you can create a new one by clicking on Create New...Calendar
    another possibiliy is to look at the portlets from our partners: on portalcenter click on Portal Catalog - Search the Portal catalog - type in 'calendar' as search word and you get back a list of available calendar portlets.
    thanks,
    christian

  • How to use the method  setReadTimeout(int longtimes) in HttpUrlConnection?

    I have to use the HttpUrlConnection to download files ,sometimes the speed is very slow or just blocked for no reason.(no Exception was throw and I can't see any changes from my swing Interface)
    It seems the thread is dead. I try to use setReadTimeout() to control the read . but it isn't working ,
    Now I have to questions?
    one how to use the setReadTimeout() so it can throw the SocketTimeoutException like the API said
    second how to solve the problem I metioned before : sometimes the speed is very slow or just blocked for no reason
    Please somebody help me !!!

    That is not true. For example ajax continuous, http monitor or media streaming in client side is unusable without nio http client (or implementation is much simple and better). All logic is coming to client side from server. Modern client are very powerful and same time servers are overloaded.

  • Interface/Method question (how to use the method insert_table)

    Hi people!
    I'm working with DOI (desktop office integration).
    So far I've been able to reflect flat variables from my ABAP program into a Word Doc, but when it comes to internal tables I'm not sure how to achieve this.....
    I find out in the interface i_oi_word_processor_document the method insert_table, but I can't find a single simple example on how to use it....
    If no one knows how to use this method, does anyone know how to reflect an internal table fron my program into a Word Doc by another mean?
    Thanks in advance!!!
    Regards,
    Laura

    Hi Laura
    If you want you can use direct OLE calls. For this, you can refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c1d54348-0601-0010-3e98-bd2a2dcd9e6c">"An Easy Reference For OLE Automation"</a> published at SDN.
    Kind Regards
    *--Serdar
    [email protected]

  • How to use the built-in camera and mic for commercial video conferencing

    I would like to use the camera and microphone to join a commercial video conference - not iChat. How do I do that?

    Hi
    Dont know, you dont say which commercial video conference software is involved.
    Tony

  • How to use the Time Variants PYTD and Prior Year Annual?

    Hi,
    We have a time dimension which has the generic columns i.e Month, Year.
    We need to calculate the Time variants for the Facts Say Sales. I was able to calculate the Prior Month, Current YTD
    I have some doubts regarding the other variants:
    1. Prior Year : Does this include the Prior Year Annual?
    2. Prior YTD: How to calculate it?
    Somehow I am getting the same results for PYTD and Prior Year.
    The formula used are :
    Prior Year:
    AGO(Sales, Year, 1)
    PYTD:
    AGO(Sales CYTD, Year, 1)
    Has anybody encountered similar issue?

    I assume the Sales measure is a monthly measure. The Prior year calculation as I described will give you the sales for the same month in the previous year when selecting month in your report. When selecting year it will add up all months of the prior year until now and you will indeed see the Prior year YTD.
    If you want to see the total sales for the previous year you have to use the same calculation as 'Prior year' and map it to the year level of your time dimension. This will work as a 'partition by year'.

  • How to use the method finalize () ? It has protected access...

    Here is the program : the structure is the way I would write in Pascal.
    I need new object question at each turn in the loop ! But question is already defined outside the loop. So, I thought to the method finalize (). But the compilator doesn't agree.... It would be a good thing however to destroy objects wich are obsolete !
    public class MM {
       public static void main (String [] args) {
          Base base = new Base ();
          base.demanderNbCouleurs ();
          base.demanderNbPions ();
          Combi solution = new Combi ();
          solution.demander ();
          Combi question = new Combi ();
          question.cueillir ();
          question.afficher ();
          Reponse reponse = new Reponse ();
          reponse.demander ();
          boolean trouve = reponse.getBP () == base.getNbPions ();
          boolean erreur = false;
          while (! trouve & ! erreur) {
             question.enregistrer (reponse.getBP (), reponse.getMP ());
             question.finalize ();
             Combi question = new Combi ();
             question.cueillir ();
             while (! question.compatible () & ! question.getVide ()) {
                question.cueillir ();
             if (question.compatible ()) {
                question.afficher ();
                reponse.demander ();
                trouve = reponse.getBP () == base.getNbPions ();
             } else {
                erreur = true;
          conclusion (trouve);
       }

    So, I did ;
             question = new Combi ();And it's magical ! The program works...
    Now, I would like to give colors to my researcher Mastermind :
    1 2 3 4
    4 4 1 1 ... BP MP : 0 2
    1 1 6 5 ... BP MP : 1 0
    1 3 4 3 ... BP MP : 1 2
    1 2 3 4 ... BP MP : 4 0
    Trouve !
    I want the 1 to be red, the 2 be yellow, the 3 be green and so on...
    Is there any procedure " textColor " ?
    here is my method afficher () :
       public void afficher () {
          // Affiche le tableau 'combi'.
          for (int i = 0; i < NB_PIONS; i++) {
             // textColor (couleur [combi );
    System.out.print (" " + combi [i]);

  • How to use the b2b to send and recieve HL& message  without SOA Composite

    Hi Guru's
    We are doing HL7 transactions at our end. We have following use case
    Inbound partner gets the HL7(ADT) message and then without any transformation we wan't to send the message to another partner ( set up in the same b2B). I understand I can do this way
    b2b--> SOA Composite--> B2B
    but we don't want to use the SOA composite here as it is simple passthrough ( i.e no transformation of data is done).
    I understand B2B when it gets the message puts in IP_IN_QUEUE
    Can b2b( remote tp) read directly from IP_QUeue and send it.
    I mean it has this strcuture
    Inbound tP--> HOST--> Outbound TP
    by doing this we will have no need to create the SOA composite. I hope this should be possible. I tried using the listening channel but outbound TP did'd got any message. Can you please guide me in all the steps I need to follow in order to set this up?
    Any pointers will be highly appreciated as this will eliminate the SOA composite from the picture.
    Regards
    Sahil

    Hi Sahil,
    Yes, it can be done using HUB mode implementation. Please refer -
    http://blogs.oracle.com/oracleb2bgurus/entry/implementing_oracle_b2b_11g_as
    A sample configuration is also provided there (for HL7 itself).
    Regards,
    Anuj

  • How to use the lcds in flex and how use the messageing serviecs in blazeds ?

    I have a problem with messageing servies in Blazeds i used the romte and proxy very well but messaging services ?

    Hi
    Dont know, you dont say which commercial video conference software is involved.
    Tony

  • I don't  know how to use these methods. actionPerformed, additem, and remov

    cand any one help me to implement these actions.
    I want to be able to select item from the the list to the textarea by using the addit button.
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Shopping extends Applet implements ActionListener, ItemListener
         private TextArea buy;
         private List foodList;
         private Button purches, remove;
         ItemList myitems;
         public void init(){          
              myitems = new ItemList();
              foodList = new List();
              foodList.add("Rice");
              foodList.add("Corn");
              foodList.add("Beans");
              foodList.add("Wheat");
              foodList.add("Banana");
              foodList.add("Bread");
              foodList.add("Meat");
              foodList.add("Fish");
              foodList.add("Nuts");
              foodList.add("Apple");
              foodList.add("may");
              foodList.add("salt");
              foodList.add("season");
              foodList.add("Beef");
              add(foodList);
              foodList.addItemListener(this);
              purches = new Button("Add IT");          
              add(purches);
              purches.addActionListener(this);
              remove = new Button("I don't want");
              add(remove);          
              remove.addActionListener(this);
              buy = new TextArea(10, 20);          
              add(buy);          
         public void itemStateChanged(ItemEvent e){
              if(e.getSource()==foodList){
                   String foodChoice = e.getItem().toString();
         public void actionPerformed(ActionEvent e){
              if(e.getSource()==purches);
              //myitems.addItem(items);
    class ItemList{
    String[] myList;
    private int count;
    public ItemList(){
    myList =new String[9];
    count=0;
    public int countList(){
    return count;
    public void addItem(String items){
    while(count < myList.length){
    myList[count++]=items;
    public void removeItem(String items){
    while(myList[count]!=null){
    if(myList[count].equals(items)){
    String discard = myList[--count];

    First of all the list does not produce any action event for a
    single click. It produces an action event for the double click.
    So you must use a choice list.
    for the list, the function used is actionPerformed(ActionEvent
    e)
    for the choice list , the function used is
    itemStateChanged(ItemEvent e)
    you must use a "\n" in the string to bring the item to the next
    line in the textarea.
    I am giving the full program below.
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Shopping extends Applet implements ActionListener, ItemListener
    //my code here.
    String items=" ";
    //my code ends here.
    private TextArea buy;
    private Choice foodList;
    private Button purches, remove;
    ItemList myitems;
    public void init(){
    myitems = new ItemList();
    foodList = new Choice();
    foodList.add("Rice");
    foodList.add("Corn");
    foodList.add("Beans");
    foodList.add("Wheat");
    foodList.add("Banana");
    foodList.add("Bread");
    foodList.add("Meat");
    foodList.add("Fish");
    foodList.add("Nuts");
    foodList.add("Apple");
    foodList.add("may");
    foodList.add("salt");
    foodList.add("season");
    foodList.add("Beef");
    add(foodList);
    foodList.addItemListener(this);
    purches = new Button("Add IT");
    add(purches);
    purches.addActionListener(this);
    //my code
    //foodList.addActionListener(this);
    remove = new Button("I don't want");
    add(remove);
    remove.addActionListener(this);
    buy = new TextArea(10, 10);
    add(buy);
    public void itemStateChanged(ItemEvent e){
    //my code here.
         String s = ((Choice)e.getItemSelectable()).getSelectedItem();
         System.out.println(s);
         items=items+s+"\n"; //the \n is given so that the next item comes in the next line.
         buy.setText(items);
    //my code ends here.
    public void actionPerformed(ActionEvent e){
    //if(e.getSource()==purches);
    //myitems.addItem(items);
    String s=((List )e.getSource()).getSelectedItem();
    System.out.println(s);
    class ItemList{
    String[] myList;
    private int count;
    public ItemList(){
    myList =new String[9];
    count=0;
    public int countList(){
    return count;
    public void addItem(String items){
    while(count < myList.length){
    myList[count++]=items;
    public void removeItem(String items){
    while(myList[count]!=null){
    if(myList[count].equals(items)){
    String discard = myList[--count];

  • How do use the method record(int score) in this code?

    how do i use record(int score) from the class Stats to record a new score?
    public class ScoreInfo {
    private int score;
    private int numStudents;
    public ScoreInfo(int aScore){
          score = aScore;
          numStudents=1;
    public void increment(){numStudents++;}
    public int getScore(){return score;}
    public int getFrequency(){return numStudents;}
    import java.util.ArrayList;
    import java.*;
    public class Stats
    private ArrayList<ScoreInfo> scoreList;
    public boolean record(int score)
         int k=0;
         while(k<scoreList.size() && score > scoreList.get(k).getScore()){
              k++;
         boolean found = k<scoreList.size() && score == scoreList.get(k).getScore();
          if(found){scoreList.get(k).increment();}
          else{scoreList.add(k,new ScoreInfo(score));}
          return found;
    public void recordScores(int[] stuScores)
    static int score = 50;
    public static void main(String[] args) throws Exception
    Stats stats = new Stats();
    ScoreInfo thestat = new ScoreInfo(score);
    stats.scoreList.add(thestat);
    }

    hiwa wrote:
    In your main() method, or in any code which tries to create a new score, below is wrong:
    ScoreInfo thestat = new ScoreInfo(score);
    stats.scoreList.add(thestat);They should be:
    stats.record(thestat); // record() method creates a new ScoreInfo
    // and add it to the scoreList, see your own posted code
    stats.record(thestat); will not work because record has a parameter that needs an integer not an object
    i tried public static void main(String[] args) throws Exception
    Stats stats = new Stats();
    ScoreInfo thestat = new ScoreInfo(7);
    stats.record(7);
    but i get this error Exception in thread "main" java.lang.NullPointerException
    at Stats.record(Stats.java:13)
    at Stats.main(Stats.java:39)

  • How to use the method substituion in variable ODI

    Hi folks,
    I have a variable that run the follow query;
    select GER_LOT_EXEC_ODI('Fluxo', 1, 'C') FROM DUAL
    GER_LOT_EXEC_ODI is a function, and i need to pass the data shema name before this:
    I'd like that stay this:
    select data_shema_user.GER_LOT_EXEC_ODI('Fluxo', 1, 'C') FROM DUAL
    I tryed with the follow method and not worked:
    select <%=odiRef.getInfo( <"SRC_SCHEMA"> )%>.GER_LOT_EXEC_ODI('Fluxo', 1, 'C') FROM DUAL
    Error log
    900 : 42000 : java.sql.SQLException: ORA-00900: invalid SQL statement
    java.sql.SQLException: ORA-00900: invalid SQL statement
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026)
         at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.execStdOrders(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTaskTrt(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTask(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    what is wrong?
    Thanks in advance
    Bovolini

    Hi,
    use <%=odiRef.getSchemaName("D")%>
    D as parameter if it is the Data Schema or W if you need the schema from Work Schema
    Your command will be like:
    select <%=odiRef.getSchemaName("D")%>.GER_LOT_EXEC_ODI('Fluxo', 1, 'C') FROM DUAL
    Works?
    Cezar Santos
    http://odiexperts.com

Maybe you are looking for

  • Seeburger AS2 comm channel problem (B2B) - "perhaps AS2ID missing"

    Hi guys! We try to configure B2B scenario using Seeburger AS2, but communication channel monitor returns error: Error type: COMPONENT_ERROR,NOT_TRANSMITTED >> Error date: 9/25/07 10:05 AM >> Description: AS2 Adapter failure Outbound configuration err

  • Maximize and minimize an application

    Hello, I`m trying to make an application and i need to be able to maximize and minimize other applications too. For example minimize and maximize Firefox. Could you provide me with an example how can i control other applications and minimize/maximize

  • Standard/best practice of Naming for MM authorisations

    Dear All, Can anybody please send the document related standard/best practice for naming convention for MM roles in authorisation. As we want to redo the authorisation system for a Client right from the scratch.(Already having SAP). to have an idea o

  • Cs5 / dynamic link / MP

    working with cs5 production bundle, dual xeon 5650, quadro fx 3800, 12gb ram. every time i import a premiere sequence (avcintra100) into ae, the multi-processor rendering is disabeld because of "incompatible effects or expressions" . no effects in th

  • Returning to Last Playlist After Restart?

    Whenever I start my Touch, I'd like to return back to the last Playlist I was playing when I last played tunes from the Touch. For instance, whenever I start the Touch and choose Music, the first item that pops up is Podcasts. I rarely choose Podcast