Search
 
SCRIPT & CODE EXAMPLE
 

PHP

date format change in laravel

//
$editData->hld_end_date ? date('d-m-Y',strtotime($editData->hld_end_date)) : null // bydefault null

date('d-m-Y',strtotime(str_replace('/', '-', $editData->hld_end_date) //bydefault value is null then 01-01-1970
                       
date_format(date_create($editData->hld_end_date),'d-m-Y') //bydefault value is null then Today date
                       
$editData->hld_end_date->format('d-m-Y') // null error
                       
CarbonCarbon::parse($editData->hld_end_date)->format('d/m/Y') //bydefault value is null then 01-01-1970
//$uj@y
Comment

date format change in laravel blade

{{date_format($data->con_date_maintained,'D M Y')}}

{{ $data->con_wash_start_date == null ? date_format($data->con_date_maintained,'D M Y') : "-" }}
//$uj@y
Comment

change the date format in laravel view page

// date('d-m-Y', strtotime($user->from_date));

public function convertDate($date,$format = 'd-m-Y'){
	return date($format, strtotime($date));
}
or
public function convertDate($date,$format = 'd/m/Y'){
        return CarbonCarbon::parse($date)->format($format);
}
$user->convertDate($user->from_date);
//$user->convertDate($user->from_date,'Y-m-d'); with format 

Comment

Change date format on view - laravel

<td>{{ date('d-M-y', strtotime($expenses->date)) }}</td>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel logs 
Php :: find value in array php 
Php :: php get property with ~ 
Php :: get the number of affected rows in php using pdo update statement 
Php :: imagick php 
Php :: php count days excluding weekends 
Php :: laravel blade php variable concatenate javascript variable 
Php :: violation: 1071 Specified key was too long; max key length is 1000 bytes 
Php :: php sort array by longest 
Php :: how to print on console with phpunit 
Php :: laravel get second last record 
Php :: Method IlluminateSupportCollection::links does not exist. 
Php :: laravel request validation rules for create and update 
Php :: php add to array 
Php :: call api with php 
Php :: extend woocommerce user fields edit-account 
Php :: mp3 file upload code in php 
Php :: get number of days between two dates php 
Php :: mail() function in php not working 
Php :: laravel copy data 
Php :: object of class stdclass could not be converted to string php laravel 
Php :: laravel project make 
Php :: wc get product category image 
Php :: php include multiple files at once 
Php :: php error handling 
Php :: laravel pivot table model 
Php :: execute script php command line 
Php :: php get array key 
Php :: install a package only composer dont update 
Php :: asset function in laravel not working 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =