How to extract month, day from created_at in Laravel?
5 answers
use
echo date('d M',$new->created_at));
For date and time manipulation, you can go through http://php.net/manual/en/function.date.php
0
source to share
$timestamp = strtotime($new->created_at);
//Uppercase letters gives day, month in language(Jan, Third, etc)
$day = date('D', $timestamp);
$month = date('M', $timestamp);
//lowercase letters gives day, month in numbers(1, 3, etc)
$day = date('d', $timestamp);
$month = date('m', $timestamp);
//use a combination of both, eg: 01 June
$final_Date = date('d', $timestamp) .' '. date('M', $timestamp);
0
source to share