Convert java.util.Date Object to a java.sql.Date Object


Following class can use for conversion.


public class UtilToSql {

  public static void main(String[] args) {
 
    java.util.Date utilDate = new java.util.Date();
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
    System.out.println("Util Date :" + utilDate);
    System.out.println("Sql Date:" + sqlDate);
 
  }

}

Result:


Util Date :Tue Sep 11 07:30:48 CDT 2012
Sql Date:2012-09-11

8 comments:

  1. Students can see the move comment without seeing the comming moves forcing them to think about the position before seeing the answer. online school management systems

    ReplyDelete
  2. You can create your own diagram showing the industries and flows that you select, in any order you choose.best virtual assistant

    ReplyDelete

  3. Business users may choose the product according to their business level. Other product by the antivirus is for different categories and users across the world rely on it to secure their data.
    For More information Visit Our Site:
    norton.com/setup
    norton.com/setup
    mcafee.com/activate
    office.com/setup

    ReplyDelete
  4. Thanks for Sharing such an amazing article. Keep working... Your Site is very nice, and it's very helping us.. this post is unique and interesting, thank you for sharing this awesome information

    PM WANI YOJANA

    ReplyDelete
  5. Your blog is filled with unique good articles! I was impressed how well you express your thoughts.


    Equitas Bank Net banking 2021 | Equitas Bank Netbanking Login 2021

    ReplyDelete
  6. You might be aware of using the Paypal services and it is not wrong to say that Paypal is one of the best, user-friendly payment platforms. Moreover, it facilitates payments that take place via online transfers between different parties. The PayPal credit login platform allows every individual to create an account on its platform that links the user to its account. Once you made an account via PayPal account login credentials you can access with an account using identification and the proof of funds as prompted.
    Paypal login
    Reddit NFL Streams
    hbomax.com/tvsignin
    primevideo.com/mytv

    ReplyDelete
  7. tv.youtube tv/start- YouTube is the best video-sharing platform. Where any users can upload and share videos with anyone able to access the site. Youtube is very different from other video-sharing platforms. It offers live shows, movies, and other video content from many channels. These videos can also be embedded and shared on other sites. YouTube was developed by former PayPal employees in 2005 and was acquired by Google in 2006. It has had a profound impact on media and advertising. It is a free video-hosting website that allows members to store and serve video content. You can easily activate YouTube TV on your device at tv.youtube.com/start.

    omegle
    Netflix login
    www.amazon.com/mytv
    amazon.com/code
    aol mail login

    ReplyDelete