Category : time

I have Project about timesheet, i have tasks table and timers table, each task has many timers and timers belong to task. I calculate the time between start_at and end_at in getTotalAttribute as you see in the pictures down, and i got the difference between them in minutes. Timer Model class TsTimer extends Model { ..

Read more

I have two var $idle1 10 minutes $idle2 = 25 seconds this values are converted from seconds to redable time with the help of the code given below $sec1 = 300; //value in seconds $sec = CarbonCarbon::now()->subSeconds($sec1)->diffForHumans(CarbonCarbon::now(), true); What i want to achieve – I want to plus this two values $idle1 + $idle2 how ..

Read more

I have a ‘services’ table having a column called ‘duration’. Its datatype is time and data stored in this column like ’00:30:00′ I also have another table for bookings having two columns ‘start_time’ and ‘end_time’. Both columns datatype are also ‘time’. I want to get summation of service->duration + booking->start_time and store it in the ..

Read more

I currently have an API of webinars where in it will post about a webinar and its time and date. I want to change the format of the following entities since I want to manually put it using my postman $table->date(‘web_start_date’)->nullable(); $table->date(‘web_end_date’)->nullable(); $table->time(‘web_start_time’)->nullable(); $table->time(‘web_end_time’)->nullable(); I read about the Carbon but I don’t exactly know how ..

Read more

I have a field in my DTO class which accepts start_time and end_time as "2:00 AM" /** * @var string */ #[CastWith(TimeCaster::class)] public string $start_time; // 01:00 AM example /** * @var string */ #[CastWith(TimeCaster::class)] public string $end_time; Can I parse this format of time using Carbon in my Caster Class #[Attribute] class TimeCaster implements ..

Read more

How can I convert this string into date format? or I think it also string to string since there’s .csv in the last portion This is my query in my database and I want to convert the last portion 32570667 into time current output 2021-03-30-32570667.csv expected output 2021-03-30 13:58:02.csv It is possible? What I’ve tried ..

Read more

Please Excuse Newbie Question but i am working on my first laravel project. I am trying to fetch time from timestamp. below is what i am trying to achieve $details=DB::table(‘CourseListNew as cl’) ->select(‘cl.Title’,’p.Title as ParentTitle’, ‘cd.Trainer’, DB::raw(‘day(cd.StartingDate) as day’), DB::raw(‘day(cd.EndingDate) as day_end’), DB::raw(‘(cd.StartingDate) as month’), DB::raw(‘year(cd.StartingDate) as year’),DB::raw(‘time(cd.StartingDate) as start_time’), DB::raw(‘time(cd.EndingDate) as end_time’), ‘cd.StartingDate’, ‘cd.EndingDate’, ..

Read more

How can I format time data type in laravel? Please see my code below. Model protected $dates = [‘start_date’, ‘end_date’, ‘show_at’, ‘hide_at’, ‘created_at’, ‘updated_at’]; View {{ $promotion->show_at->format(‘h:i:s A’) }} Data from database (type: time) 23:59:59 Error Unexpected data found. Unexpected data found. Source: Laravel Sta..

Read more