How the time of 2014-1-1 after submission became 2014-01-01

Source: Internet
Author: User
When I import data using an Excel table, for example:
$KQ _date= $data->sheets[0][' cells ' [$i][3]//This is the 3rd column, if it's 2014-1-1
So how to make $kq_date write to the database when it becomes 2014-01-01, because if it doesn't become 2014-01-01, writing to a database field becomes 0000-00-00, and I don't know what's going on.

Reply to discussion (solution)

echo Date (' y-m-d ', strtotime (' 2014-01-01 '));

Yours??? Save?? is the field type date?

If it's a string, you can convert it.

$d = ' 2014-1-1 '; Echo date (' y-m-d ', Strtotime ($d));

This should be the wrong type of field that your database is saved in.
One is to change the type of field saved by the database
The second is to use the date and Strtotime functions.

Oh, then I found the reason, is the wrong type

  • Related Article

    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: 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.