Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
2 votes
1 answer
55 views

I have this CarbonPeriod with start 2025年06月09日 19:00 and end 2025年06月11日 11:00. What I want is an array of the days with start and end date. So basicly an array like this, possibly with new ...
1 vote
2 answers
78 views

In laravel 10 / php 8.2 time I have a time field and in model I have defined cast: <?php namespace App\Casts; use Carbon\Carbon; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use ...
mstdmstd's user avatar
  • 3,341
-1 votes
1 answer
86 views

On Laravel 11 site with php 8.3 I need to get only time(hours/minutes) from request time field with value [time] => 2025年03月18日T07:23:16.000Z So I need result must be 07:23 I try to use ...
1 vote
2 answers
277 views

I'm working on a leave/holiday management system. As well as booking full days leave/holiday they can book half days (morning or afternoon off). I need to calculate the total amount of days during a ...
PeteB's user avatar
  • 153
1 vote
2 answers
427 views

I recently updated nesbot/Carbon from 2.67 to 3.8.6. When running the following piece of code, I used to get a positive value, now I get a negative value. Has the order of operation changed for ...
Pete's user avatar
  • 107
0 votes
1 answer
74 views

I am formatting the dates of all weeks in a date range that exceeds 1 year using CarbonPeriod: $period = CarbonPeriod::create('2024-01-01', '1 week', '2025-01-31'); foreach ($period as $date) { ...
0 votes
1 answer
332 views

I'm registering a custom Carbon macro in my Laravel's AppServiceProvider Carbon::macro('itFormat', static function () { return ucwords(self::this()->translatedFormat('l d/m/Y')); }); But ...
madbob's user avatar
  • 660
0 votes
1 answer
69 views

I'm facing an issue in my Laravel 10 application where accessing the created_at attribute directly from a model instance returns a different value than when using the value() method on the same model. ...
3 votes
1 answer
355 views

I have this code: try { Carbon::createFromFormat('dmY', $rawDate)->format('Ymd'); } catch (InvalidFormatException $e) { echo 'Oops, bad date format.'; } If I feed in 31012024 as my $...
-1 votes
1 answer
146 views

My goal is to store microseconds in a MariaDB database timestamp fields when using a laravel application. Following the instructions on https://carbon.nesbot.com/laravel/, I created my Grammar class: ...
0 votes
2 answers
193 views

I'm using model factory methods in my Laravel test suite that return date ranges. For instance: class WorkSiteFactory extends Factory { // ... Other factory stuff.... /** * Indicate that the ...
1 vote
1 answer
118 views

I'm having an issue with timestamps in my Laravel app. Our database stores timestamps in CEST, but when I cast them to a datetime object, Laravel automatically converts them to UTC, even though my ...
1 vote
1 answer
65 views

Why in In laravel 11, PHP 8.2 app running code $minDay = CurrencyHistory::select(DB::raw('MIN(day) as min_day'))->first()->min_day; \Log::info($minDay); \Log::info(Carbon::createFromTimestamp(...
mstdmstd's user avatar
  • 3,341
0 votes
2 answers
116 views

While using the nesbot/carbon library I've noticed that it accepts single letters as valid dates and parses them in a way that maps to a relative time range. Specifically, single letters are parsed (...
0 votes
2 answers
43 views

I display a diffForHumans with one part echo Carbon::create('1 hour 59 minutes ago')->diffForHumans(); // 1 hour ago echo Carbon::create('1 day 23 hours ago')->diffForHumans(); // 1 day ago echo ...
PaulH's user avatar
  • 3,139

15 30 50 per page
1
2 3 4 5
...
100

AltStyle によって変換されたページ (->オリジナル) /