0

Добрый день. Есть база Oracle, в ней таблица, один из столбцов - в формате date. В php цепляюсь к таблице и выбираю из нее инфу.

$conn = oci_connect("xxx", "xxx", "xxx");
$query_1 = "select max (p.navi_date), p.navi_user
from payments p
where p.pay_date >= trunc(sysdate)
and p.navi_user = 'HAS:WWW:PARDOXT'
group by  p.navi_user
order by 1";
$s_1 = oci_parse($conn, $query_1);
oci_execute($s_1);
oci_fetch_all($s_1, $arr_1);
$o_1 = $arr_1['MAX(P.NAVI_DATE)'];
echo($o_1[0]);

в итоге на странице выдается дата в формате 11.06.15 Как сделать, чтобы ее формат был 11.06.15 14:31:16?

2 ответа 2

0

DATE columns are returned as strings formatted to the current date format. The default format can be changed with Oracle environment variables such as NLS_LANG or by a previously executed ALTER SESSION SET NLS_DATE_FORMAT command.

Example #8 oci_fetch_array() with DATE columns

Или явно через to_char(max(...), 'dd.mm.yy hh24:mi:ss').

0

echo date('d.m.y H:i:s', strtotime($o_1[0]));

1
  • 11.06.15 11:06:15 - Показывает дубляж даты, а мне время нужен. 11 июн 2015 в 7:57

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.