0

I use a FTP site to upload my work, which resides on a server running on a Linux OS based on nginx. And I use an odbc driver to connect to a database that interacts with my php code. In that database exists a date column type that returns the full date & time. I need to retrieve just the date. I used the CONVERT function convert(varchar(10), date_col, 110)and get the needed result using it withAptanaStudio as my IDE. But my php code returns an empty field. What have I done wrong? The code:

<?php 
$odbc = odbc_connect(...);
$odbc_res = odbc_exec($odbc, "select convert(varchar(10), rep_date, 110) from table");                                                                            
?>
<table>
<thead>
<th>Date is:</th>                                             
</thead>
<tbody>

<?php $r = odbc_fetch_array($odbc_res_c) ?>
<tr>
<td><?= $r['rep_date'] ?></td>   
</tr>
</tbody>
</table>
  • There are lots of DBMS, which are you using? – Jan Oct 3 '14 at 13:40
  • AquaData Studio -> Sybase – Daria Oct 3 '14 at 13:43
  • Would you mind posting the php code that receives the date? – eyoung100 Oct 3 '14 at 13:52
  • Edited the question – Daria Oct 3 '14 at 14:05
0

So I used dancing with PHP code, and got the solution

$r['rep_date'] = mb_substr(strval($r['rep_date']), 0, 10, 'UTF-8');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.