Is it a Java Date bug?

Please take a look at below code:
public class Test {
     public static void main(String[] args) {
          Calendar c1 = Calendar.getInstance();
          c1.set(2000, 0, 1, 1, 0, 0); //2000-01-01 01:00:00
          long l1 = c1.getTimeInMillis();
          Calendar c2 = Calendar.getInstance();
          c2.set(2000, 0, 1, 0, 0, 0); //2000-01-01 00:00:00
          long l2 = c2.getTimeInMillis();
          if (l1 > l2) {
               System.out.println("true");
          Date d = new Date();
          SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
          d.setTime(l1);
          System.out.println(df.format(d));
          d.setTime(l2);
          System.out.println(df.format(d));
The output of this program is:
true
2000-01-01 01:00:00
2000-01-01 12:00:00
Isn't this output weird? The first date should be 1 hour later than the second one, but the result is the first one is 11 hour earlier than the second.
Anyone know why?

It just adds "am" or "pm" to the date format, but the problem still exists.It is not a problem. This is the correct display as per the "12-hours clock" notation (specified by the "hh" in the SimpleDateFormat); see this [url http://en.wikipedia.org/wiki/12-hour_clock]wikipedia entry, especially the section on "Confusion at noon and midnight"

Similar Messages

  • How to do sorting/filtering on custom java data source implementation

    Hi,
    I have an entity driven view object whose data should be retrieved and populated using custom java data source implementation. I've done the same as said in document. I understand that Query mode should be the default one (i.e. database tables) and createRowFromResultSet will be called as many times as it needs based on the no. of data retrieved from service, provided we should write the logic for hasNextForCollection(). Implementation sample code is given below.
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {      
    Iterator datumItr = retrieveDataFromService(qc, params);
    setUserDataForCollection(qc, datumItr);
    hasNextForCollection(qc);
    super.executeQueryForCollection(qc, params, noUserParams);
    protected boolean hasNextForCollection(Object qc) {
    Iterator datumItr = (Iterator) getUserDataForCollection(qc);
    if (datumItr != null && datumItr.hasNext()){
    return true;
    setCallService(false);
    setFetchCompleteForCollection(qc, true);
    return false;
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
    Iterator datumItr = (Iterator) getUserDataForCollection(qc);
    Object datumObj = datumItr.next();
    ViewRowImpl r = createNewRowForCollection(qc);
    return r;
    Everything is working fine include table sorting/filtering. Then i noticed that everytime when user perform sorting/filtering, executeQueryForCollection is called, which in turn calls my service. It is a performance issue. I want to avoid. So i did some modification in the implementation in such a way that, service call will happen only if the callService flag is set to true, followed by executeQuery(). Code is given below.
    private boolean callService = false;
    public void setCallService(boolean callService){
    this.callService = callService;
    public boolean isCallService(){
    return callService;
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams){
    if (callService)
    Iterator datumItr = retrieveDataFromService(qc, params);
    setUserDataForCollection(qc, datumItr);
    hasNextForCollection(qc);
    super.executeQueryForCollection(qc, params, noUserParams);
    Issue i have:
    When user attempts to use table sort/filter, since i skipped the service call and set null as userDataCollection, createRowFromResultSet is not called and data which i retrieved and populated to view object is totally got vanished!!. I've already retrived data and created row from result set. Why it should get vanished? Don't know why.
    Tried solution:
    I came to know that query mode should be set to Scan_Entity_Cache for filtering and Scan_View_Rows for sorting. I din't disturb the implementation (i.e. skipping service call) but overrided the executeQuery and did like the following code.
    @Override
    public void executeQuery(){
    setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
    super.executeQuery();
    By doing this, i could able to do table filtering but when i try to use table sorting or programmatic sorting, sorting is not at all applied.
    I changed the code like beolw*
    @Override
    public void executeQuery(){
    setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
    super.executeQuery();
    Now sorting is working fine but filtering is not working in an expected way because Scan_View_rows will do further filtering of view rows.
    Question:
    I don't know how to achieve both filtering and sorting as well as skipping of service call too.
    Can anyone help on this?? Thanks in advance.
    Raguraman

    Hi,
    I have an entity driven view object whose data should be retrieved and populated using custom java data source implementation. I've done the same as said in document. I understand that Query mode should be the default one (i.e. database tables) and createRowFromResultSet will be called as many times as it needs based on the no. of data retrieved from service, provided we should write the logic for hasNextForCollection(). Implementation sample code is given below.
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
      Iterator datumItr = retrieveDataFromService(qc, params);
      setUserDataForCollection(qc, datumItr);
      hasNextForCollection(qc);
      super.executeQueryForCollection(qc, params, noUserParams);
    protected boolean hasNextForCollection(Object qc) {
      Iterator datumItr = (Iterator) getUserDataForCollection(qc);
      if (datumItr != null && datumItr.hasNext()){
        return true;
      setFetchCompleteForCollection(qc, true);
      return false;
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
      Iterator datumItr = (Iterator) getUserDataForCollection(qc);
      Object datumObj = datumItr.next();
      ViewRowImpl r = createNewRowForCollection(qc);
      return r;
    }Everything is working fine include table sorting/filtering. Then i noticed that everytime when user perform sorting/filtering, executeQueryForCollection is called, which in turn calls my service. It is a performance issue. I want to avoid. So i did some modification in the implementation in such a way that, service call will happen only if the callService flag is set to true, followed by executeQuery(). Code is given below.
    private boolean callService = false;
    public void setCallService(boolean callService){
      this.callService = callService;
    public boolean isCallService(){
      return callService;
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams){
      if (callService) {
        Iterator datumItr = retrieveDataFromService(qc, params);
        setUserDataForCollection(qc, datumItr);
      hasNextForCollection(qc);
      super.executeQueryForCollection(qc, params, noUserParams);
    }Issue i have:
    When user attempts to use table sort/filter, since i skipped the service call and storing of userDataCollection, createRowFromResultSet is not called and data which i retrieved and populated to view object is totally got vanished!!. I've already retrived data and created row from result set. Why it should get vanished? Don't know why.
    Tried solution:
    I came to know that query mode should be set to Scan_Entity_Cache for filtering and Scan_View_Rows for sorting. I din't disturb the implementation (i.e. skipping service call) but overrided the executeQuery and did like the following code.
    @Override
    public void executeQuery(){
      setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
      super.executeQuery();
    }By doing this, i could able to do table filtering but when i try to use table sorting or programmatic sorting, sorting is not at all getting applied.
    I changed the code like below one (i.e. changed to ViewObject.QUERY_MODE_SCAN_VIEW_ROWS instead of ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS)
    @Override
    public void executeQuery(){
      setQueryMode(callService ? ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES : ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
      super.executeQuery();
    }Now sorting is working fine but filtering is not working in an expected way because Scan_View_rows will do further filtering of view rows.
    If i OR'ed the Query Mode as given below, i am getting duplicate rows. (vewObject.QUERY_MODE_SCAN_ENTITY_ROWS | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS) Question:
    I don't know how to achieve both filtering and sorting as well as skipping of service call too.
    Can anyone help on this?? Thanks in advance.
    Raguraman
    Edited by: Raguraman on Apr 12, 2011 6:53 AM

  • Java Embedding bug in SOA Suite 11g BPEL??

    I am beginning to wonder if there is a 'bug' in the SOA Suite 11g, BPEL, Java Embedding activity? Need some help as soon as possible – does the Java Embedding activity work in SOA Suite 11g?
    Have tried the following on Jdev 11.1.1.1 and Jdev 11.1.1.3 – get the same error message (see below for error message).
    Thanks for any help - Casey
    I created a simple composite app by:
    1.     Created a Composite with BPEL Process
    2.     Created a BPEL variable by the name of Variable and a Simple Type of string      ({http://www.w3.org/2001/XMLSchema}string)
    3.     Added an Assign activity (Assign_1) and assigned the value of “Test Var” to the variable Variable using a Copy operation.
    4.     Then, after the assign activity, added a Java Embedding activity (Java_Embedding_1) with Java Version set to 1.5 and the following code:
    +try{+*
    String var;*
    var=(String)getVariableData(Variable);*
    System.out.println(var);*
    +}  // end try+
    +catch(Exception ex){+*
    System.out.println(ex.getMessage());*
    +}// end catch+
    Compiled and got the following error message:
    Error(23,34): Failed to compile bpel generated classes.*
    failure to compile the generated BPEL classes for BPEL process "BPELProcess1" of composite "default/Project1!1.0"*
    The class path setting is incorrect.*
    Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.*
    Code for the BPEL component is:
    +<?xml version = "1.0" encoding = "UTF-8" ?>+
    +<!--+
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    Oracle JDeveloper BPEL Designer
    Created: Tue Nov 09 13:01:49 CST 2010
    Author:
    Purpose: Asynchronous BPEL Process
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    -->
    +<process name="BPELProcess1"+
    targetNamespace="http://xmlns.oracle.com/TestgetVariable_jws/Project1/BPELProcess1"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:client="http://xmlns.oracle.com/TestgetVariable_jws/Project1/BPELProcess1"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/TestgetVariable/Project1/FileW"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    +<!--+
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    PARTNERLINKS
    List of services participating in this BPEL process
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    -->
    +<partnerLinks>+
    +<!--+
    The 'client' role represents the requester of this service. It is
    used for callback. The location and correlation information associated
    with the client role are automatically set using WS-Addressing.
    -->
    +<partnerLink name="bpelprocess1_client" partnerLinkType="client:BPELProcess1" myRole="BPELProcess1Provider" partnerRole="BPELProcess1Requester"/>+
    +</partnerLinks>+
    +<!--+
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    VARIABLES
    List of messages and XML documents used within this BPEL process
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    -->
    +<variables>+
    +<!-- Reference to the message passed as input during initiation -->+
    +<variable name="inputVariable" messageType="client:BPELProcess1RequestMessage"/>+
    +<!-- Reference to the message that will be sent back to the requester during callback -->+
    +<variable name="outputVariable" messageType="client:BPELProcess1ResponseMessage"/>+
    +<variable name="Variable" type="xsd:string"/>+
    +</variables>+
    +<!--+
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    ORCHESTRATION LOGIC
    Set of activities coordinating the flow of messages across the
    services integrated within this business process
    +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+
    -->
    +<sequence name="main">+
    +<!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess1.wsdl) -->+
    +<receive name="receiveInput" partnerLink="bpelprocess1_client" portType="client:BPELProcess1" operation="process" variable="inputVariable" createInstance="yes"/>+
    +<!--+
    Asynchronous callback to the requester. (Note: the callback location and correlation id is transparently handled using WS-addressing.)
    -->
    +<assign name="Assign_1">+
    +<copy>+
    +<from expression='"test var"'/>+
    +<to variable="Variable"/>+
    +</copy>+
    +</assign>+
    +<bpelx:exec name="Java_Embedding_1" version="1.5" language="java">+
    +<![CDATA[/*Write your java code below e.g.+
    +     System.out.println("Hello, World");+
    +*/+
    +try{+
      +String var;+
      +var=(String)getVariableData(Variable);+
      +System.out.println(var);+
    +} // end try+
    +catch(Exception ex){+
    System.out.println(ex.getMessage());
    +}// end catch]]>+
    +</bpelx:exec>+
    +<invoke name="callbackClient" partnerLink="bpelprocess1_client" portType="client:BPELProcess1Callback" operation="processResponse" inputVariable="outputVariable"/>+
    +</sequence>+
    +</process>+

    Java Embedding bug in SOA Suite 11g BPEL??

  • Simple java date related question

    Hi Friends,
    I have written this custom date class that compares two dates. The user can enter any number of days,and it should calculate the next date,is that possible???
    public class Date implements Comparable {
         private int month, day, year;
         public Date(int m, int d, int y) {
              month = m;
              day = d;
              year = y;
         public int compareTo(Object o) {
              Date a = this;
              Date b = (Date) o;
              if (a.year < b.year) return -1;
              if (a.year > b.year) return 1;
              if (a.month < b.month) return -1;
              if (a.month > b.month) return 1;
              if (a.day < b.day) return -1;
              if (a.day > b.day) return 1;
              return 0;
         public String toString() {
              return month + "/" + day + "/" + year;
         public static void main(String[] args) {
              Date d1 = new Date(21, 03, 2007);
              int days = Integer.parseInt(args[0]);
              System.out.println("New date is:"); // Need to print new date
    Expected output:
    java Date 30
    New date is: 04/20/2007If this is not possible with this class,how can we do this, any ideas.
    Your help would be appreciated.
    Thanks

    Hi,
    Try this code out:
    import java.text.DateFormat;
    import java.util.*;
    import javax.swing.JOptionPane;
    public class SimpleDate {
         private int month, day, year;
         public SimpleDate() {
              Date date = new Date();
             String myString = DateFormat.getDateInstance().format(date);
             StringTokenizer tokens = new StringTokenizer(myString, "/");
             day = Integer.parseInt(tokens.nextToken());
             month = Integer.parseInt(tokens.nextToken());
             year = Integer.parseInt(tokens.nextToken());
         public SimpleDate(String stdate) {
              try {
                   StringTokenizer tokens = new StringTokenizer(stdate, "/");
                   day = Integer.parseInt(tokens.nextToken());
                   month = Integer.parseInt(tokens.nextToken());
                   year = Integer.parseInt(tokens.nextToken());
              catch(Exception e) {
                   Date date = new Date();
                  String myString = DateFormat.getDateInstance().format(date);
                  StringTokenizer tokens = new StringTokenizer(myString, "/");
                  day = Integer.parseInt(tokens.nextToken());
                  month = Integer.parseInt(tokens.nextToken());
                  year = Integer.parseInt(tokens.nextToken());
                   JOptionPane.showMessageDialog(null, "Invalid String,\nDate set to current", "Invalid String", JOptionPane.ERROR_MESSAGE);
         public SimpleDate(int d, int m, int y) {
              month = m;
              day = d;
              year = y;
         public int compareTo(Object o) {
              SimpleDate a = this;
              SimpleDate b = (SimpleDate) o;
              if (a.year < b.year) return -1;
              if (a.year > b.year) return 1;
              if (a.month < b.month) return -1;
              if (a.month > b.month) return 1;
              if (a.day < b.day) return -1;
              if (a.day > b.day) return 1;
              return 0;
         private int getNumOfDaysInMonth() {
              boolean leap = false;
              int days = 30;
              if (year % 4 == 0) leap = true;
              if ((month == 1) | (month == 3) | (month == 5) | (month == 7) |
                        (month == 8) | (month == 10) | (month == 12)) {
                   days = 31;
              if ((month == 4) | (month == 6) | (month == 9) | (month == 11)) {
                   days = 30;
              if (month == 2) {
                   if (leap) {
                        days = 29;
                   else days = 28;
              return days;
         public void addDays(int nums) {
              while (nums > getNumOfDaysInMonth()) {
                   nums = nums - getNumOfDaysInMonth();
                   addMonths(1);
              day = day + nums;
              while (day > getNumOfDaysInMonth()) {
                   day = day - getNumOfDaysInMonth();
                   addMonths(1);
         public void addMonths(int nums) {
              while (nums > 12) {
                   nums = nums - 12;
                   addYears(1);
              month = month + nums;
              while (month > 12) {
                   month = month - 12;
                   addYears(1);
         public void addYears(int nums) {
              year = year + 1;
         public int getDay() {
              return day;
         public int getMonth() {
              return month;
         public int getYear() {
              return year;
         public String toString() {
              return day + "/" + month + "/" + year;
    }I have swapped the day and month around from mm/dd/yyyy to dd/mm/yyyy
    but otherwise its still the same basic code

  • Issue with "firstRecord" Business Component method of JAVA Data bean API.

    Hi,
    Following is my use-case scenario:
    I have to add or associate child MVG business component (CUT_Address)
    with the parent business component (Account) using JAVA Data bean API.
    My requirement is: first to check whether child business component(i.e. CUT_address) exists. If it exists then associate it with parent business component (Account)
    otherwise create new CUT_address and associate it with account.
    Code (using JAVA Data bean APIs) Goes as follows:
    SiebelBusObject sBusObj = connBean.getBusObject("Account");
    parentBusComp = sBusObj.getBusComp("Account");
    SiebelBusComp parentBusComp;
    SiebelBusComp childBusComp;
    // retrieve required account.. Please assume Account1 exists
    parentBusComp.activateField("Name");
    parentBusComp.clearToQuery();
    parentBusComp.setSearchSpec("Name", "Account1");
    sBusComp.executeQuery2(true, true);
    sBusComp.firstRecord();
    Counter = 0;
    while (counter < Number_Of_Child_Records_To_Insert)
    childBusComp = parentBusComp.getMVGBusComp("City");
    associatedChildBusComp = childBusComp.getAssocBusComp();
    childBusComp.activateField("City");
    childBusComp.clearToQuery();
    childBusComp.setSearchSpec("City", Vector_of_city[counter]);
    sBusComp.executeQuery2(true, true);
    if( sBusComp.firstRecord() )
    // Child already exist and do processing accordingly
    else
    // Child does not exist and do processing accordingly
    childBusComp.release();
    childBusComp = null;
    associatedChildBusComp.release();
    associatedChildBusComp=null;
    Now the issue with this code is: For the first iteration, SbusComp.firstRecord returns 0 if records does not exist. However from the second iteration, SbusComp.firstRecord returns 1 even if there is no record matching the search specification.
    Any input towards the issue is highly appreciable.
    Thanks,
    Rohit.

    Setting the view mode to "AllView" helped.
    Thanks for the lead!
    In the end, I also had to invoke the business component method SetAdminMode with "true" as the argument so that I could also modify the records from my script.

  • The DATA BUG of OVI 3.03 on E72, disgusting!

    Nearly at the same time at the afternoon today - 25 Jan. Many of the users of E72 found their New OVI Maps occured a serious problem. When they open the icon "My place" in GPS, the program halt and no response at all. Many of them think maybe it just be a problem of their own E72 or due to some collisions of the software they installed and even formate the phone or reinstall the OVI maps many times. But as I confrim on some forums,I make sure that this is a BUG of the software.
    First of all, I should declare the OVI maps and software I installed on my E72 were all download form official website maps.nokia.com and with newest verison.
    The Symptom is:
    1. when you open OVI maps and click the "my place"  icon the program halt unless you shutdown the program in task manager or restart the phone.  But if you click the "search" first only once, then all the functions will be ok.
    2. If you change the date to 24 Jan or 26 Jan, every thing is OK. And if you change the date to 15, 25 of anyother months if only the date contain "5", the problem will happen again.
    From this symptom, I can sure it is a DATE BUG of new OVI maps. I just CAN NOT believe NOKIA could made this stupid mistake. I hope NOKIA could fix it or update the software ASAP.
    Message Edited by joeye on 25-Jan-2010 11:00 PM

    Hi,
    We think we know the cause of this issue to be the welcome note localised to Latvian.
    From what we can tell from your firmware version, you are running a latvian varient. We are aware (and have fixed for the next release) that the welcome note, translated to latvian, was causing the application to crash.
    To work around this until the release is made available, please do the following:
    Change the device language, for example to English, and restart the Maps application. Once the application is started, you should then be able to exit the application, revert the language back to Latvian, and restart the Maps application without it Crashing.
    Please let me know if this resolves your issue.
    KR
    Chris
    Although i work for Nokia, my opinions are my own!
    Got a Maps query? Check our Maps FAQ's

  • External SOAP client Accessing Webservice using built in Java Data type

    We have built a webservice and deployed it on WLS. We accessed this from a swing
    client it works fine.The webservice methods uses non-built in JAVA data types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass to the
    webservice. We dont want to go by this way.Is there anyway were in we can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net client )
    will be able to exceute my webservice (i.e., passing the required Object which
    the method is expecting)?

    Hi Anish,
    Well first off, your web service doesn't send or receive "objects". It only sends
    and recieves XML, which is in turn converted to/from Java objects at invocation
    time. Second, a .NET (or Perl, or Python, or C++) client will be able to call
    your web service, because the wsdl.exe tool (for .NET) will generate "programming
    language specific" objects from the <types><schema> elements, in the WSDL of your
    web service :-) The wsdl.exe tool will create C# objects from the WSDL, that will
    convert XML to/from C# when your web service is called. That's the beauty of XML
    schema - it's a "universal typing system", so it's not tied to a particular programming
    language. The only issue is whether or not the web services platform vendor's
    XML Schema/WSDL processor, can successfully process the WSDL. Some vendors have
    more complete implementations of the WSDL and XML Schema specs than others, so
    expect varying success here. The one in WLS 7.0 is pretty good, so you shouldn't
    have too many problems consuming WSDL generated by .NET tools (or any other tool
    for that matter).
    Regards,
    Mike Wooten
    "Anish" <[email protected]> wrote:
    >
    We have built a webservice and deployed it on WLS. We accessed this from
    a swing
    client it works fine.The webservice methods uses non-built in JAVA data
    types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value
    objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass
    to the
    webservice. We dont want to go by this way.Is there anyway were in we
    can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net
    client )
    will be able to exceute my webservice (i.e., passing the required Object
    which
    the method is expecting)?

  • From Time column in Excel to Java Date ?

    Hi there!
    After I have read range data from Excel to a Java Object[][]
    array/table, one of my excel time columns becomes "floats"
    numbers when I try to access them in Java, like this:
    from 15:00:00 in Excel to 0.625 in my Java program
    How can I avoid this OR transform/parse this 0.625 number
    back again to time/Date 15:00:00 inside Java ? hmmm
    Is there any setup of jCom that can controll this somehow ?
    I have been able to transform:
    from 11.15.01 in Excel, becomes "Thu Nov 15 00:00:00 CET 2001"
    with the jCom bridge ...
    When I have this "string" on this format, it's easy
    to get a Java Date of this with SimpleDateFormat.
    ... but not with this time of mine :-)
    Any clues where to look or a solution for this ?
    -- Thank you !
    -- Erlend

    Excel stores times as decimal fractions (representing portions of a day)
    There is no Time data type in VB so is probably represented by a Single
    object.
    This object is then converting to a java.lang.float on the Java side.
    0.625 can be parsed by multiplying by (24*60*60) to get the number
    of seconds after midnight.
    A list of supported COM data types and their java equivalents
    can be found in chapter 7 of the jCOMReference pdf file.
    damon
    "Erlend Bjorge" <[email protected]> wrote in message
    news:3be2983e$[email protected]..
    >
    Hi there!
    After I have read range data from Excel to a Java Object[][]
    array/table, one of my excel time columns becomes "floats"
    numbers when I try to access them in Java, like this:
    from 15:00:00 in Excel to 0.625 in my Java program
    How can I avoid this OR transform/parse this 0.625 number
    back again to time/Date 15:00:00 inside Java ? hmmm
    Is there any setup of jCom that can controll this somehow ?
    I have been able to transform:
    from 11.15.01 in Excel, becomes "Thu Nov 15 00:00:00 CET 2001"
    with the jCom bridge ...
    When I have this "string" on this format, it's easy
    to get a Java Date of this with SimpleDateFormat.
    ... but not with this time of mine :-)
    Any clues where to look or a solution for this ?
    -- Thank you !
    -- Erlend

  • Java dates from 0-11 or 1-12

    Hello
    In java Date, the months ranges from 0-11 . first january is thus 1/0/2003 (in dd/mm/yyyy form). But in almost all databases , month values are counted as 1-12 . That is first january becomes 1/1/2003 . Obviously we have to show the users month values from 1-12 and not from 0-11. This obviuosly places some overhead when doing calculations and display. Sometimes there are situations where we have to get the date from database using getString() function, but that will vary with the result of Resultset.getDate() . Any way to overcome such limitations? and why java has such dates?

    I kind of agree. When I first started, I felt that I shouldn't ever rely upon an assumption about the value of a constant field (i.e. Calendar.JANUARY, etc).
    But since I did need to have a user-intuitive interface (both in guis and because we deal regularly with processing today's or yesterday's version of a file named like yyyyMMdd.input), I always provided a class that was a day-only object who did its behind-the-scenes work with Calendar by using switch statements to choose the correct Calendar month constants (rather than by adding or subtracting one).
    But (a) that got old quick because of either the same cumbersome code repeated everywhere or having to have many otherwise simple standalone programs depend on a central utility class to do this, and (b) the Calendar class documentation states that the value of the month is zero-based, so the horror of assuming constant values is not so bad.
    So now I have slightly less cumbersome code (adding or subtracting one) repeated everywhere...

  • How to execute Custom java data source LOV view object from a common mthd?

    Hi,
    My application contains Custom java data source implemented LOVs. I want to have a util method which gets the view accessor name, find the view accessor and execute it. But i couldn't find any API to get the view accessors by passing the name.
    Can anyone help me iin how best view accessors can be accessed in common but no by creating ViewRowImpl class (By every developer) and by accessing the RowSet getters?
    Thanks in advance.

    I am sorrry, let me tell my requirement clearly.
    My application is not data base driven. Data transaction happens using tuxedo server.
    We have entity driven VOs as well as programmatic VOs. Both are custom java data source implemented. Entity driven VOs will participate in transactions whereas programmatic VOs are used as List view object to show List of values.
    Custom java datasource implementation in BaseService Viewobject Impl class looks like
            private boolean callService = false;
        private List serviceCallInputParams = null;
        public BaseServiceViewObjectImpl()
            super();
         * Overridden for custom java data source support.
        protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams)
            List dataFromService = null;
            if(callService)
                callService = retrieveDataFromService(serviceCallInputParams);
            setUserDataForCollection(qc, dataFromService != null? dataFromService.iterator(): null);   
            super.executeQueryForCollection(qc, params, noUserParams);
         * Overridden for custom java data source support.
        protected boolean hasNextForCollection(Object qc)
            Iterator<BaseDatum> datumItr = (Iterator<BaseDatum>) getUserDataForCollection(qc);
            if (datumItr != null && datumItr.hasNext())
                return true;
            callService = false;
            serviceCallInputParams = null;
            setFetchCompleteForCollection(qc, true);
            return false;
        }Individual screen developer, who want to load data to VO, will do something like the below code in their VO impl class
        public void fetch()
            BaseServiceViewObjectImpl vo = this;
            vo.setCallService(true);
            vo.setServiceCallInputParams(new ArrayList());
            vo.executeQuery();
        }As these custom java data source implemented LOV VOs comes across the screens, i want to have a util method at Base VOImpl class, that gets the view accessor name, finds the LOV VO instance, retrieves data for that. I want to do something like
         * Wrapper method available at Base Service ViewObject impl class
        public void fetchLOVData(String viewAccessorName, List serviewInputParams)
            // find the LOV View object instance
            BaseServiceViewObjectImpl lovViewObject  = (BaseServiceViewObjectImpl) findViewAccessor(viewAccessorName);
            // Get data for LOV view object from service
            lovViewObject.setCallService(true);
            lovViewObject.setServiceCallInputParams(serviewInputParams);
            lovViewObject.executeQuery();
    Question:
    1. Is it achievable?
    1. Is there any API available at View Object Impl class level, that gets the view accessor name and returns the exact LOV view object instance? If not, how can i achieve it?

  • Customized java date function in heart of JDK

    hi
    how can i force JDK to return Persian or Arabic date instead of christian era?
    i have an application in java platform. i couldn't change code of program, because source is closed and is not reachable. i want to know how can i use a wrapper for date function in java? if it is possible how can i replace java date functionality with my desired date function?
    thanks for any help

    Thanks for your help.
    however i looking for one thing, similar a function wrapper that can substitute original method.
    I don't know where the application use date function and how calls it. so i think that it is possible to change behavior of java itself.

  • Nokia X6 *NEW* date bug.

    This is a new possible bug which I've just spotted on my Nokia X6 16GB, which is slightly worse than the date incorrect bug described here: /t5/Xseries/X6-Date-incorrect/td-p/684385
    Instead of the date on the phone reverting back by 24 hours, when I switched on my X6 just now, the date reverted all the way back to 01/01/2010 
    This is the 1st time I've seen a X6 have its system date automatically shoot all the way back to 1st Jan 2010.
    Bug detected on firmware version 31.0.004
    If you have encountered this problem, please post it here.

    This is also associated with the other date bug, I have seen this as well as losing a day.

  • Problem with updating oracle DB with java date thru resultset.updateDate()

    URGENT Please
    I am facing problem in updating oracle database with java date through resultset.updateDate() method. Can anybody help me please
    following code is saving wrong date value (dec 4, 2006 instead of java date jul 4, 2007) in database:
    ResultSet rs = stmt.executeQuery("SELECT myDate FROM myTable");
    rs.first();
    SimpleDateFormat sqlFormat = new SimpleDateFormat("yyyy-mm-dd");
    java.util.Date myDate = new Date();
    rs.updateDate("myDate", java.sql.Date.valueOf(sqlFormat.format(myDate)));
    rs.updateRow();

    I believe you should use yyyy-MM-dd instead of yyyy-mm-dd. I think MM stands for month while mm stands for minute as per
    http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    (If this works, after spending so much of your time trying to solve it, don't hit yourself in the head too hard. I find running out of the room laughing hysterically feels better).
    Here is a more standard(?) way of updating:
    String sqlStatement=
    "update myTable set myDate=? where personID=?"
    PreparedStatement p1= connection.prepareStatement(sqlStatement);
    p1.setDate(1,new java.sqlDate());
    p1.setInt(2, personID);
    p1.executeUpdate();

  • Java data types are tightly coupled or loosely coupled ?

    java data types are tightly coupled or loosely coupled ?

    Is this another interview question? If so, the answer you should have given is, "You, sir, have been smoking too much crack."

  • Connect to java data srvice

    hi,
    how to connect to java data/services ?
    I  had this error :
    Invalid root. The WEB-INF/flex folder must contain either flex-config.xml or services-config.xml.
    my project java is in : D:\SVN\VAZII\trunk\VaziiAdminService
    my project flex tha must use the service is in : D:\SVN\ICOSNET_WALLET\trunk\ConfortPayAdmin
    My server tomcat is in : C:\apache-tomcat-7.0.32
    what i must write in this input dialog box ?
    Root Folder, Root URl, and Context root
    thanks

    is there someone that knows flash builder here ?

Maybe you are looking for