Any latest addition regarding java.sql.Date

I have separate strings "10/21/2003" and "02:33:27".
Just to convert String "10/21/2003" to sql date, do I really need to call up simple date format and parsing it?
why? there is no time associated with this string. The time is on a separate string.
I am using preparedstatement.

Did I do unnecessary steps in getting to sql.Date ?
String sDate = "10/16/2003";
String sTime = "02:12:54:;
String year = sDate.substring(6,9);
String month = sDate.substring(0,1);
String day = sDate.subst....
String sDateNew = year + "-" + month + "-" + day;
// the string becomes 2003-10-16.
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date uDate = sdf.parse(sDateNew);
long time = uDate.getTime();
java.sql.Date sqlDate = new java.sql.Date(time);
pstmt.setDate(i, sqlDate);
It works, but did I put in extra steps ?
I tried using the same trick for sTime, but that did not work out.

Similar Messages

  • Needed help regarding converting  string to java.sql.Date format

    I have a a function which returns a calendar object. The date must be inserted to Oracle DB using java.sql.Date format.
    So i have converted the Calendar object to java.sql.Date format using the following code
    java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());But while getting inserted into the DB it was in mm/dd/yyyy format whereas i wanted dd/mm/yyyy format
    Can any body please help out how to store the date in dd/mm/yyyy format ?

    Can u please explain this a bit
    This is my code
    public int addBook(List<Book> BookList) throws SQLException, ParseException{
              System.out.println("Hi there");
              Book book = new Book();
              BookDB bookDb = new BookDB();
              //listLength =      BookList.length;
              String bookId = null;
                   try{
                        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                        con  = DriverManager.getConnection("jdbc:oracle:thin:@10.123.79.195:1521:findb01","e115314", "e115314");
                        addBook = con.prepareStatement("insert into ABC_Book values(?,?,?,?,?,?,?)");
                        Iterator<Book> iterator = BookList.iterator();
                        while(iterator.hasNext()){
                             book = (Book)iterator.next();
                             System.out.println(book.getBookId());
                             addBook.setString(1,book.getBookId());
                             addBook.setString(2,book.getTitle());
                             addBook.setString(3,book.getAuthor());
                             addBook.setString(4,book.getPublisher());
                             System.out.println(book.getPublicationDate());
                             System.out.println("Before Date");
                             System.out.println("book.getPublicationDate().getTime()"+book.getPublicationDate().getTime());
                             java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());
                             SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yyyy");
                             dateString = formatter.format(publicationDate);
                             System.out.println("Today is"+dateString);
                             java.sql.Date date = (java.sql.Date)formatter.parse(dateString);
                             System.out.println("date"+date);
                             //java.sql.Date publicationDate = (Date)book.getPublicationDate().getTime();
                             //System.out.println("Value of date is"+publicationDate);
                             System.out.println("After Date");
                             addBook.setDate(5,publicationDate);
                             addBook.setString(6,book.getCountry());
                             addBook.setString(7,book.getLanguage());
                             rs = addBook.executeQuery();
                             //con.commit();
                             rowCount = rowCount + rs.getRow();
                        return rowCount;
                   catch(SQLException se){
                        se.printStackTrace();
                   finally{
                        con.close();
                        System.out.println("After adding ");
              return 0;
         }

  • Poblem with java.sql.Date while inserting to a table

    Hi All,
    I have a PostgreSQL database table which contains fields(columns ) of type date. I want to insert values to the table in the[b] �dd-MMM-YYYY� format using the prepared statement.
    My code is as follows
    java.text.DateFormat dateFormatter =new java.text.SimpleDateFormat("dd-MMM-yyyy");
    String formatedDate=dateFormatter.format(theDate);
    currentDate = new java.sql.Date(dateFormatter.parse(formatedDate).getTime())
    �������������������
    �������������������
    �������������������
    pst.setDate(12,currentDate);The problem is the currentDate variable gives date only in the �YYYY-MMM-dd� format but requirement is the currentDate variable should give date in the �dd-MMM-YYYY� format and this should be save to table as java.sql.Date type
    There is any solution???? please help me...
    Thanks and Regards,
    Hyson_05

    Hi,
    What are you talking about? A Date does always wrap a millisecond value, and doesn't have any formatting. It's the database, or your program which formats the date that you see.
    In short. You should format the value when you print it, and not when you store it.
    Kaj

  • Convert a String to java.sql.Date Format

    Hi,
    I am having a String of containing date in the format 'dd/mm/yyyy' OR 'dd-MMM-YYYY' OR 'mm-dd-yyyy' format. I need to convert the string to java.sql.Date object so that I can perform a query the database for the date field. Can any one suggest me with the code please.
    Regards,
    Smitha

    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class TestDateFormat
         public static void main(String args[])
              SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
              System.out.println(sdf.isLenient());
              try
                   Date d1 = sdf.parse("07-11-2001");
                   System.out.println(d1);
                   Date d2 = sdf.parse("07:11:2001");
                   System.out.println(d2);
              catch(ParseException e)
                   System.out.println("Error format, " + e);
    See class DateFormat and SimpleDateFormat for detail.

  • Convert java.sql.date to dd.mm.yyyy format

    Hi,
    Can any one tell me how to convert java.sql.date to dd.mm.yyyy format
    Regards,
    H.V.Swathi

    Hi ,
    Create a simple data type of type java.sql.date and give the format in it as "dd/MM/yyyy". This will work i guess.
    Regards
    Ishita

  • OpenSQLException - object of type java.sql.Date is not normalized

    Hi,
    I am attempting to code an SQL query in an EJB and get the following exception:
    com.sap.sql.log.OpenSQLException: The object of type java.sql.Date with the value '2010-06-04 13:21:09.424' assigned to host variable 1 is not normalized. It must not contain time components in the time zone running the virtual machine. at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85) at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124) at com.sap.sql.jdbc.common.CommonPreparedStatement.setDate(CommonPreparedStatement.java:650) at......
    Below is the code snippet I am using:
                        private static String selWQ  = "Select * from ZZZZ_TABLE " +
                                                                       "where DATEFROM >= ? " +
                                                                  "and DATETO <= ? ";
         public UsageRecord[] getRecords(Date fromDate,Date toDate)
              UsageRecord[] ura = null;
              String q          = null;
              ArrayList al      = new ArrayList();
              try
                   q = selWQ;
                   conn.open();
                   PreparedStatement p = conn.prepareStatement(q);               
                   p.setDate(1, fromDate);
                   p.setDate(2,toDate);                    
                   ResultSet rs = p.executeQuery();
    I have a PreparedStatement and am using setDate to set the values. The fromDate and toDate parameters are of type java.sql.Date
    Can someone please tell me what I am doing wrong and how to fix it?
    thanks
    Brian

    As requested, here is an example of what I used to resolve this:
                   PreparedStatement p = conn.prepareStatement(q);
                   SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd");
                                               String sFrom = ddf.format(new java.util.Date(fromDate));
                   String sTo   = ddf.format(new java.util.Date(toDate));
                   p.setDate(1, java.sql.Date.valueOf(sFrom));
                   p.setDate(2, java.sql.Date.valueOf(sTo));
                   ResultSet rs = p.executeQuery();
    fromDate and toDate are parameters of type long...
    regards
    Brian

  • Java.sql.Date vs java.util.Date vs. java.util.Calendar

    All I want to do is create a java.sql.Date subclass which has the Date(String) constructor, some checks for values and a few other additional methods and that avoids deprecation warnings/errors.
    I am trying to write a wrapper for the java.sql.Date class that would allow a user to create a Date object using the methods:
    Date date1 = new Date(2003, 10, 7);ORDate date2 = new Date("2003-10-07");I am creating classes that mimic MySQL (and eventually other databases) column types in order to allow for data checking since MySQL does not force checks or throw errors as, say, Oracle can be set up to do. All the types EXCEPT the Date, Datetime, Timestamp and Time types for MySQL map nicely to and from java.sql.* objects through wrappers of one sort or another.
    Unfortunately, java.sql.Date, java.sql.Timestamp, java.sql.Time are not so friendly and very confusing.
    One of my problems is that new java.sql.Date(int,int,int); and new java.util.Date(int,int,int); are both deprecated, so if I use them, I get deprecation warnings (errors) on compile.
    Example:
    public class Date extends java.sql.Date implements RangedColumn {
      public static final String RANGE = "FROM '1000-01-01' to '8099-12-31'";
      public static final String TYPE = "DATE";
       * Minimum date allowed by <strong>MySQL</strong>. NOTE: This is a MySQL
       * limitation. Java allows dates from '0000-01-01' while MySQL only supports
       * dates from '1000-01-01'.
      public static final Date MIN_DATE = new Date(1000 + 1900,1,1);
       * Maximum date allowed by <strong>Java</strong>. NOTE: This is a Java limitation, not a MySQL
       * limitation. MySQL allows dates up to '9999-12-31' while Java only supports
       * dates to '8099-12-31'.
      public static final Date MAX_DATE = new Date(8099 + 1900,12,31);
      protected int _precision = 0;
      private java.sql.Date _date = null;
      public Date(int year, int month, int date) {
        // Deprecated, so I get deprecation warnings from the next line:
        super(year,month,date);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public Date(String s) {
        super(0l);
        // Start Cut-and-paste from java.sql.Date.valueOf(String s)
        int year;
        int month;
        int day;
        int firstDash;
        int secondDash;
        if (s == null) throw new java.lang.IllegalArgumentException();
        firstDash = s.indexOf('-');
        secondDash = s.indexOf('-', firstDash+1);
        if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length()-1)) {
          year = Integer.parseInt(s.substring(0, firstDash)) - 1900;
          month = Integer.parseInt(s.substring(firstDash+1, secondDash)) - 1;
          day = Integer.parseInt(s.substring(secondDash+1));
        } else {
          throw new java.lang.IllegalArgumentException();
        // End Cut-and-paste from java.sql.Date.valueOf(String s)
        // Next three lines are deprecated, causing warnings.
        this.setYear(year);
        this.setMonth(month);
        this.setDate(day);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public static boolean isWithinRange(Date date) {
        if(date.before(MIN_DATE))
          return false;
        if(date.after(MAX_DATE))
          return false;
        return true;
      public String getRange() { return RANGE; }
      public int getPrecision() { return _precision; }
      public String getType() { return TYPE; }
    }This works well, but it's deprecated. I don't see how I can use a java.util.Calendar object in stead without either essentially re-writing java.sql.Date almost entirely or losing the ability to be able to use java.sql.PreparedStatement.get[set]Date(int pos, java.sql.Date date);
    So at this point, I am at a loss.
    The deprecation documentation for constructor new Date(int,int,int)says "instead use the constructor Date(long date)", which I can't do unless I do a bunch of expensive String -> [Calendar/Date] -> Milliseconds conversions, and then I can't use "super()", so I'm back to re-writing the class again.
    I can't use setters like java.sql.Date.setYear(int) or java.util.setMonth(int) because they are deprecated too: "replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date)". Well GREAT, I can't go from a Date object to a Calendar object, so how am I supposed to use the "Calendar.set(...)" method!?!? From where I'm sitting, this whole Date deprecation thing seems like a step backward not forward, especially in the java.sql.* realm.
    To prove my point, the non-deprecated method java.sql.Date.valueOf(String) USES the DEPRECATED constructor java.util.Date(int,int,int).
    So, how do I create a java.sql.Date subclass which has the Date(String) constructor that avoids deprecation warnings/errors?
    That's all I really want.
    HELP!

    I appreciate your help, but what I was hoping to accomplish was to have two constructors for my java.sql.Date subclass, one that took (int,int,int) and one that took ("yyyy-MM-dd"). From what I gather from your answers, you don't think it's possible. I would have to have a static instantiator method like:public static java.sql.Date createDate (int year, int month, int date) { ... } OR public static java.sql.Date createDate (String dateString) { ... }Is that correct?
    If it is, I have to go back to the drawing board since it breaks my constructor paradigm for all of my 20 or so other MySQL column objects and, well, that's not acceptable, so I might just keep my deprecations for now.
    -G

  • Problem Writing java.sql.Date to MS Access

    I have a relatively simple application that is for my own use (not distributed on an enterprise-wide basis). As I don't have an IT staff, I'm using a rudimentary Java front-end (v1.3.1) and a Microsoft Access backend.
    I seem to have trouble using INSERT/UPDATE statements with the MS Access Date/Time data type. Below is an example of code being used (id is defined as Text, amount is a Number and timestamp is Date/Time):
    conn = DriverManager.getConnection("jdbc:odbc:markets", "", "");
    conn.setAutoCommit(true);
    String sql = "INSERT INTO temp (id, amount, timestamp) VALUES (?, ?, ?)";
    PreparedStatement stmt = conn.prepareStatement(sql);
    String id = args[0];
    int len = id.length();
    java.sql.Date dt = new java.sql.Date(new java.util.Date().getTime());
    stmt.setString(1, id);
    stmt.setDouble(2, id.length());
    // I think the problem is here - the JDBC driver doesn't properly map dates to Access???
    stmt.setDate(3, dt);
    stmt.execute();
    stmt.close();
    conn.close();And I get the following error:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access
    Driver] Syntax error in INSERT INTO statement.
            at sun.jdbc.odbc.JdbcOdbc.createSQLException (JdbcOdbc.java:6879)
            at sun.jdbc.odbc.JdbcOdbc.standardError (JdbcOdbc.java:7036)
            at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect (JdbcOdbc.java:3065)
            at sun.jdbc.odbc.JdbcOdbcStatement.execute (JdbcOdbcStatement.java:338)
            at TestWritingDate.main(TestWritingDate.java:31) I'm virtually certain this is a translation problem with
    the java.sql.Date and the JDBC driver. But I can't seem
    to overcome this. Any help is DESPERATELY needed.
    Thanks.
    Matt

    That was it....thanks...didn't even consider that....perhaps I should start using class names that are already in use too :-). Thanks again...

  • How to change a date value from "java.util.Date" to "java.sql.Date"?

    Hi all,
    How to change a date value from "java.util.Date" to "java.sql.Date"?
    I m still confusing what's the difference between them.....
    thanks
    Regards,
    Kin

    Thanks
    but my sql statement can only accept the format (yyyy-MM-dd)
    such as "select * from xx where somedate = '2004-12-31'
    but when i show it to screen, i want to show it as dd-MM-yyyy
    I m using the following to change the jave.util.Date to str and vice versa. But it cannot shows the dd-MM-yyyy. I tried to change the format from yyyy-MM-dd to dd-MM-yyyy, it shows the wrong date in my application.
         public String date2str(java.util.Date thisdate)     {
              if (thisdate != null)     {
                   java.sql.Date thissDate = new java.sql.Date(thisdate.getTime());
                   return date2str(thissDate);
              }     else     {
                   return "";
         public String date2str(java.sql.Date thisdate)     {
              if (thisdate != null)     {
                   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                   return sdf.format(thisdate);
              }     else     {
                   return "";
         public java.util.Date str2date(String thisdate)     {
              String dateFormat = "yyyy-MM-dd"; // = 1998-12-31
              java.util.Date returndate = null;
              if (thisdate != null)     {
                   SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
                   try {
                        returndate = dateFormatter.parse(thisdate);
                   } catch (ParseException pe) {
                        System.out.println (pe.getMessage());
              return returndate;
         }

  • Java.sql.Date and java.util.Date - class loaded first in the classpath

    I had two jar files which has java.util.Date and java.sql.Date class file. i want to know whether which class is loaded first in the classpath...
    I like to change the order of loading the class at runtime...
    Is there is any way to change the order of loading of class...
    I may have different version of jar files for example xerces,xercesImpl. some of the code uses xerces ,some of the code uses xercesImpl..i had common classes.
    I like to load the class with the same name according to the order i need..
    Can we do all these in Run time ?????

    I had two jar files which has java.util.Date and
    java.sql.Date class file. i want to know whether
    which class is loaded first in the classpath...
    I like to change the order of loading the class at
    runtime...
    Is there is any way to change the order of loading of
    class...
    I may have different version of jar files for example
    xerces,xercesImpl. some of the code uses xerces ,some
    of the code uses xercesImpl..i had common classes.
    I like to load the class with the same name according
    to the order i need..
    Can we do all these in Run time ?????That is meaningless.
    The classes you are referring to are part of the Java API. Third party jars have no impact on that. And you can't change to the order because java.sql.Data is derived from java.util.Date. So the second must load before the first.
    And if you have two jar files with those classes in them (and not classes that use them) then you either should already know how to use them or you should stop trying to do whatever you are doing because it isn't going to work.

  • Put java.sql.Date in correct format

    I need to put java.sql.Date in correct format to query an Oracle database.
    Here is my code:
            SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
            java.util.Date dateChosen = jXDatePicker1.getDate();
            String strDate = formatter.format(dateChosen);
            System.out.println("Date Chosen: " + strDate); // output is: 11-Feb-00
            java.util.Date parserDate = null;      
            try {
                parserDate = formatter.parse(strDate);
            } catch (ParseException re) {
                System.err.println("Exception caught: " + re.getMessage());
            // create java.sql.Date object
                java.sql.Date oraDate = new java.sql.Date(parserDate.getTime());
            System.out.println(oraDate);  // date is in this format: 2000-02-11
            System.out.println("formatted oraDate: " + formatter.format( oraDate ) ); // no good, stringIf I use formatter.format( oraDate ) I get the correct format (11-Feb-00) BUT it is no longer a sql Date, it is a String which can't be use.
    I have looked at the API and many other forum threads on this, any help would be greatly appreciated!

    In the class with the PreparedStatement, I pass the date like this:
    public class report extends javax.swing.JDialog {
         java.sql.Date newDate;
        public report(java.sql.Date passedOraDate, String passedtxtDate) {
            super();
            initComponents();
            setTitle("Report");
            setModal(true);
            newDate = passedOraDate;
            statusLabel.setText(passedtxtDate);
            System.out.println("passedtxtDate: " +passedtxtDate);       
            System.out.println("newDate: " +newDate);      
        }Here is the code that uses the actual PreparedStatement:
            try {
                // In my actual code I have all columns listed in query
                String query = "SELECT * FROM report WHERE repdate = ?";
                ps = conn.prepareStatement(query); // create a statement
                           ps.setDate(1, newDate); // set input parameter
                rs = ps.executeQuery();
                // extract data from the ResultSet
                ResultSetMetaData md = rs.getMetaData();
                int columns = md.getColumnCount();This is greatly edited to show relevant code!

  • Convert string into java.sql.Date

    Hi,
    I want to convert a date in string form into java.sql.Date to persist into the database column with Date as its datatype in Oracle. I'm trying as follows:
    import java.sql.Date;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    public class DateTest
    public static void main(String[] args)
    String strDate = "2002-07-16 14:45:01";
         System.out.println("strDate = "+strDate);
    Date aDate = null;
    try
    if(strDate != null && !strDate.trim().equals(""))
         SimpleDateFormat aSDF = new SimpleDateFormat();
         aSDF.applyPattern("yyyy-MM-dd hh:mm:ss");
         java.util.Date utilDate = aSDF.parse(strDate);
    System.out.println("utildate = "+utilDate);
         aDate = new Date(utilDate.getTime());
         aDate.setTime(utilDate.getTime());      
         System.out.println("aDate = "+aDate);
    catch (ParseException e)
    System.out.println("Unable to parse the date - "+strDate);
    catch (Exception ex)
    ex.printStackTrace();
    System.out.println("Caught Exception :"+ex.getMessage());
    It gives the output as :
    strDate = 2002-07-16 14:45:01
    utildate = Tue Jul 16 14:45:01 IST 2002
    aDate = 2002-07-16
    If I put this value into the database table, I can see only the date. Time part is missing. Is this the problem with java.sql.Date or Oracle datatype Date? Please help me asap.
    Thanks in advance.
    Regards,
    Rajapriya.R.

    If I put this value into the database table, I can
    see only the date. Time part is missing. Is this the
    problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

  • PreparedStatement.setDate(1,java.sql.Date x) problem

    I am using Sun JDBC-ODBC bridge to access MS SQL Server 2000. I have following statement:
    java.util.Date date = new java.util.Date();
    java.sql.Date expire_date = new java.sql.Date(date.getTime());
    PreparedStatement pstat = con.prepareStatement("update account set expire_date=? where userid=?");
    pstat.setDate(1,expire_date);
    pstat.setString(2,userid);
    When I ran the program, I got a SQLException error as
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional features not implemented.
    I have traced the problem happened in the statement pstat.setDate(1,expire_date). I use jdbc-odbc bridge from j2se 1.3.1.
    I appreciate any help.
    Thanks, Brian

    May I refer to a recent topic where I explained a lot about date conversion between JDBC and SQLServer?
    http://forum.java.sun.com/thread.jsp?forum=48&thread=241049
    Try how far this helps you, then ask more.

  • Java.sql.Date output help

    i want to add a date to a mysql databse but im getting incorrect info...
    here is a similiar code to what i have in my software
    import java.util.Calendar;
    import java.sql.Date;
    public class test {
         public static void main(String[] args) {
            Calendar c = Calendar.getInstance();
            int year = c.get(Calendar.YEAR);
            int month = c.get(Calendar.MONTH);
            int day = c.get(Calendar.DAY_OF_WEEK);
            Date d = new Date(year, month, day);
            System.out.println(d);
    }i get 3906-09-06 as an output...please help

    Date d = new Date(year, month, day);
    The year is a number from 1900. So u need to substract 1900 from the value u got before.
    Regards,
    Eyal

  • Difference in two java.SQL.Date in Days

    Collegues,
    I have two java.sql.Dates. One sendDate and other is recieveDate. Could you please tell me how can I calculate the diffenence in these two dates in Days.
    Thank you

    HI DOCSOFT
    here is the code
    public int DayDiff(String start, String end)
    try
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    Date startDate = dateFormat.parse(start);
    Date endDate = dateFormat.parse(end);
    GregorianCalendar calStart = new GregorianCalendar();
    calStart.setTime(startDate);
    GregorianCalendar calEnd = new GregorianCalendar();
    calEnd.setTime(endDate);
    if (calStart.get(Calendar.YEAR) == calEnd.get(Calendar.YEAR))
    return calEnd.get(Calendar.DAY_OF_YEAR) - calStart.get(Calendar.DAY_OF_YEAR);
    else if ((calEnd.get(Calendar.YEAR) - calStart.get(Calendar.YEAR)) == 1)
    int daysEndYear = calEnd.get(Calendar.DAY_OF_YEAR);
    int daysStartYear = calStart.getActualMaximum(Calendar.DAY_OF_YEAR) - calStart.get(Calendar.DAY_OF_YEAR);
    return daysEndYear + daysStartYear;
    else
    int startYear = calStart.get(Calendar.YEAR);
    int endYear = calEnd.get(Calendar.YEAR);
    GregorianCalendar cal = new GregorianCalendar();
    int days = 0;
    for (int i = startYear + 1; i < endYear; i++)
    cal.set(Calendar.YEAR, i);
    days += cal.getActualMaximum(Calendar.DAY_OF_YEAR);
    days += calEnd.get(Calendar.DAY_OF_YEAR);
    days += (calStart.getActualMaximum(Calendar.DAY_OF_YEAR) - calStart.get(Calendar.DAY_OF_YEAR));
    return days;
    catch (ParseException e)
    return -1;
    sorry about the formatting
    hope this works
    Regards
    Satinderjit

Maybe you are looking for

  • Assigning a value to a string

    Hi Friends, How to assign a value to a string. Coz I need to compare the strings with the user entered string and process the logic. Example : p_pass TYPE string p_pass = 'APPLE'. Regards, SMP

  • Integration Engine Proxy Runtime Error

    Hello, I have  ECC and PI server for my landsacpe. When i ran SXMB_IFR tcode in my ECC server i got the follwing error under Runtime work Bench Proxy Runtime - it is shows red color. Unable to log on to system ECC120   in language en with user PIRWBU

  • Creating File in Shift-JIS, Japanese Encoding for EFT

    Hi, We need to do EFT for the data which is present in Shift-JIS(JA16SJIS), Japanese characterset. Our database is having NLS_CHARACTERSET -- UTF8 NLS_NCHAR_CHARACTERSET -- AL16UTF16 File needs to be sent to the bank in the Shift-JIS format, I need t

  • IMac HD Blower Fan

    Several weeks ago my iMac began making quite a bit of noise. I pulled out the hard drive and replaced it, but it made no difference. (Yes, I'm out of warranty.) A systems monitor shows that my HD fan does not remain at a consistent speed, and I belie

  • Ibooks on ipad with iOS5: app crashes when clicking on a book. What to do?

    Whenever I try to use the ibooks app on my ipad 1 with OS 5, it crashes. That defeats the purpose. Is there a way to fix this problem?