0

Query Codeigniter:

$bookvisit = $this->db->query("SELECT ( SELECT name FROM tbl_user as u WHERE u.user_id=b.user_id ) as BookVisitFrom, b.status as status, b.booktime as booktime, b.bookdate as bookdate, --> b.created as created, b.is_confrim as is_confrim, b.id as id FROM tbl_bookvisit as b "); 

I want only Date from DateTime from the "created"(its column name) how can i get it!!

4
  • 1
    So what are you getting right now and in which format Commented Mar 18, 2015 at 7:46
  • This query working?It should produce error.WHERE u.user_id=b.user_id is invalid statement Commented Mar 18, 2015 at 8:14
  • yes this query is working Commented Mar 18, 2015 at 8:38
  • i am getting all database values but in need DATE only in created column Commented Mar 18, 2015 at 8:39

1 Answer 1

2

You can use date function for it

date(b.created) as created mysql> select date('2015-01-01 20:30:40') as only_date ; +------------+ | only_date | +------------+ | 2015-01-01 | +------------+ 1 row in set (0.00 sec) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.