Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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>
share|improve this question
    
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

1 Answer 1

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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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