Convert timestamp to date in Laravel? -


how can return database rows timestamp converted date (d-m-y h:i), using all() method?

it's not created_at or updated_at column, it's custom attribute, call birthday if wish.

in case, need convert date within query, if mysql being used database may use raw query this:

// assumed my_birthday 1255033470 $raw = db::raw("date_format(from_unixtime(my_birthday),'%b %d, %y %l:%i %p') dob"); $result = model::get(array('id', 'username', $raw)); 

you may write within single line:

$result = model::get(array('id', 'username', db::raw("..."))); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -