Search
 
SCRIPT & CODE EXAMPLE
 

PHP

human readable date laravel

$object->updated_at->diffForHumans();
Comment

laravel human readable date

<?php

$date = Carbon::now();

echo $date->toDateString();
// 2020-06-22

echo $date->toDateTimeString();
// 2020-06-22 19:45:23

echo $date->toFormattedDateString();
// Jun 22, 2020

echo $date->toTimeString();
// 19:45:23

echo $date->toDayDateTimeString();
// Mon, Jun 22, 2020 7:45 PM

echo Carbon::now()->subDays(5)->diffForHumans();
// 5 days ago

echo Carbon::now()->subDays(24)->diffForHumans();
// 3 weeks ago

echo Carbon::now()->subMonth()->diffForHumans();
// 1 month ago

echo Carbon::create('2020')->longRelativeDiffForHumans('2018');
// 5 months 3 weeks 19 hours 40 minutes 54 seconds ago
Comment

PREVIOUS NEXT
Code Example
Php :: magento 2 get collection 
Php :: php text Cyrillic check 
Php :: laravel export make comman 
Php :: persian error laravel 
Php :: twig create new array 
Php :: php close session 
Php :: add new column to table laravel 
Php :: php client enable short tags 
Php :: strpos in python 
Php :: send email when form is submitted php 
Php :: make pagination wordpress admin panel 
Php :: php mysql error 
Php :: write file in php 
Php :: Git delete single branch 
Php :: laravel not in query 
Php :: lluminateHttpExceptionsPostTooLargeException 
Php :: laravel eloquent get 3 months 
Php :: laravel get input from request 
Php :: check string in php 
Php :: link to another page php 
Php :: Composer detected issues in your platform: Your Composer dependencies require a PHP version "= 8.0.2". 
Php :: Displaying all table names in php from MySQL database 
Php :: php get random value from array 
Php :: specified key was too long max key length is 767 bytes 
Php :: add column in table laravel 
Php :: insert timestamps manually in laravel 
Php :: grouping routes in laravel 
Php :: wordpress get link to post by id 
Php :: how to find the name of login user in laravel 
Php :: wordpress get date of post 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =