Carbon – check hours after midnight – Laravel
in a laravel app I have a range of times(start and end), if the end time is after 00:00:00, then it would be set to the next Day edit for exemple : start = 22:00:00 and end = 04:00:00 so…
in a laravel app I have a range of times(start and end), if the end time is after 00:00:00, then it would be set to the next Day edit for exemple : start = 22:00:00 and end = 04:00:00 so…
I use Laravel and I deployed my application on Docker I use carbon package for time management and I set the timezone to Asia/Tehran But now I found a problem and the time are moved forward one hour and I…
When I try to use carbon diffInMonths() it gives me values less 1, why is that? $months = Carbon::parse('2023-11-30')->diffInMonths(Carbon::parse('2023-10-01'), false); //$months = 1 instead of 2 What am I doing wrong? I am manually adding 1 after results which is…
I want to calculate the time difference between two datetime. Saturday and sunday need to be excluded from the calculation. For exemple difference between 2023-01-10 15:12:24 and 2023-01-01 10:34:36 is 6 days 4 hours 37 minutes 48 seconds according to…
For me it's strange, i set 'timezone' => 'America/Los_Angeles', cleared config & cache. but now when i dd(now()) or dd(now('America/Los_Angeles')) i get and when return an array like below, result aren't in desired time zone. i want default now() return…
I have a start date $start = Carbon::parse('2023-03-01 10:00:00'); and an end date $end = Carbon::parse('2023-03-02 17:00:00'); I want to get the minutes between 10:00:00 and 17:00:00 ignoring the date. I made this working with $time_end = $end->toTimeString(); $time_start =…
When I try to get the last day of next month by PHP or Laravel carbon, everything is ok, but when I try to get the last day of next month from a specific date, 2023-01-31, by date('Y-m-01', strtotime('next month',…
I am looking for a way to determine the next occurrence of a certain day of a month. This would refer to a numbered day (e.g. the next 30th). Every month should always have one eligible date, so in case…
i want to check the date format of the database value. I want to put a check in my code if the format of the date string is correct. If it is not correct then store the empty value. $getTmpAfSite…
I have made this method for sending a temporary code to user's mobile phone number for verifying his account: public function signInWithToken() { if(Session::has('nextStep') && Session::has('foundUser')) { $user = User::where('usr_mobile_phone', Session::get('foundUser'))->first(); if(Session::has('codeSent')){ $nowTime = now(); $sentTime = Session::get('codeSent'); if($nowTime >=…