Query oracledate data in php

Source: Internet
Author: User
Tags php example
Question about querying oracledate data in php? A problem occurred when I used the oci function to query oracle data a few days ago. that is, when I found data of the date type, I used plsql to query the data in the oracle database, which is 2009-9-2912: 12: 12 & nbsp; but the query using the select * fromtablename statement, the query of oracle date data in php obtained by using the oci_fetch_array () function?
A problem occurred when I used the oci function to query oracle data recently. that is, when I found date data, I used pl/SQL to query the data displayed in the oracle database.
9-9-29 12:12:12
However, if you use the select * from tablename statement to query, the value of this time field obtained by using the oci_fetch_array () function is
September 30-09
How can I convert the field in this format to the above field, or how can I transfer the field in the above format to the time field in php?
Because I am not sure which field the time field is when I query it, I cannot use the time function in the oracle database to convert the specified field. it is best to convert it in php.
Thank you for your advice.

------ Solution --------------------
If the int type is used for the field storing the time, this problem will not occur. when the database is inserted, the time is converted to the timestamp for insertion. after reading the data, the timestamp is used to restore it to the time, this can improve the query time efficiency. You can also avoid the above situation!
------ Solution --------------------
Let's take a look at the official php example of oralce:

Http://www.oracle.com/technology/global/cn/pub/articles/oracle_php_cookbook/fuecks_dates.html

Try this way (just my understanding ):

Select name, to_char (regtime, 'DD-MM-YYYY HH: MI: SS') from tablename;
------ Solution --------------------
Positive solution on the third floor

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.