Mysql-how can I insert a mysql-time null value to the database?

Source: Internet
Author: User
Java reads json data to MySQL. The value of regist_time in json is String and the value of Date in the database. if the value of regist_time is null, the database cannot be inserted. If all regist_time values are NULL, if (regist_time & quot;) regist_time & quot; 0000-00 & quot; simpledateformatnewsimpledateformat (& quot; yyyy-MM-dd-mysqljson

Java reads json data to MySQL. The value of regist_time in json is String and the value of Date in the database. if the value of regist_time is null, the database cannot be inserted. If all regist_time values are NULL, the time is from January 1, 0000 to August 00,
If (regist_time = "") regist_time = "0000-00 ";
SimpleDateFormat format = new SimpleDateFormat ("MM dd, yyyy ");
Date date = format. parse (regist_time );
Java. SQL. Date sqlDate = new java. SQL. Date (date. getTime ());

Return sqlDate;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.