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:

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

<?php $r = odbc_fetch_array($odbc_res_c) ?>
<td><?= $r['rep_date'] ?></td>   
  • 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

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.