none
How to convert java.util.Date to java.sql.Date? RRS feed

  • Question

  • I need a java.sql.Date.

    I was surprised to find that I can not do the conversion implicitly or explicitly - but I do not even know how I would do it, since the Java API is still pretty new to me.

    I have this code as well


    java.util.getTimer();
           java.util.Date utilDate=new java.util.Date();
    java.sql.Date sqlDate = new
           java.sql.Date(utilDate.getTime());
           System.out.println("utilDate: " +utilDate);
           
           java.sql.Date sqlDate = java.sql.Date.valueOf( todayLocalDate );
           
         
           
               
               ps.setDate(7,Date_Hourd_publicatiom);

    I need a java.sql.Date.

    I was surprised to find that I can not do the conversion implicitly or explicitly - but I do not even know how I would do it, since the Java API is still pretty new to me.I need a java.sql.Date. I was surprised to find that I can not do the conversion implicitly or explicitly - but I do not even know how I would do it, since the Java API is still pretty new to me.
    I need a java.sql.Date. I was surprised to find that I can not do the conversion implicitly or explicitly - but I do not even know how I would do it, since the Java API is still pretty new to me.
    Monday, August 7, 2017 9:05 PM

Answers

All replies