10+ Carbon DateTime "Tricks" You May Not Know

  Рет қаралды 28,221

Laravel Daily

Laravel Daily

Күн бұрын

Пікірлер: 49
@depreza68
@depreza68 2 жыл бұрын
1) now, today, yesterday, tomorrow 00:44 2) timezones 01:37 3) getters 02:32 4) start, end, next 03:30 5) add and sub 05:13 6) differences 06:24 7) set test now 07:31 8) comparison 08:28 9) is it X ? 08:54 10) rounding 09:55
@randomguy5922
@randomguy5922 4 жыл бұрын
whenever i open carbon documentation, i close it.....because it looks huge.
@abelenocrodriguez
@abelenocrodriguez 4 жыл бұрын
Thank you very much for taking the time to explain this in the video, could you make a video explaining how to do database deploy in a production environment?
@PovilasKorop
@PovilasKorop 4 жыл бұрын
What exactly are you struggling with, when deploying database? Here's a video that may help you: kzbin.info/www/bejne/bnW5pomcqauNmbM
@abelenocrodriguez
@abelenocrodriguez 4 жыл бұрын
@Povilas Korop I mean how not to remove sensitive data from the database in a production environment, for example; if I add a different data structure to the one that is written as adding it without the data in production being affected... Thank you for responding.
@PovilasKorop
@PovilasKorop 4 жыл бұрын
@@abelenocrodriguez This one is very very individual - depending on your data structure, on how much downtime you can afford for longer migration etc. There's no "one trick" here, I'm afraid.
@abelenocrodriguez
@abelenocrodriguez 4 жыл бұрын
​@@PovilasKorop Thank you, I understand, but isn't there a guide or a page that gives recommendations on how to deal with this issue in production?
@PovilasKorop
@PovilasKorop 4 жыл бұрын
@@abelenocrodriguez I don't know any ONE guide. It's like "isn't there a guide on how to fix computers" - there are many different computers, right? I'm planning a few videos on that topic in upcoming days/weeks, one about changing relationship from one-to-many to many-to-many (and migrating data), and another video about how to seed data when the project is live.
@christopherokonkwo
@christopherokonkwo 2 жыл бұрын
Watching in 2022 Christmas Day and it still feels like the video was short yesterday...Carbon is really powerful
@mibrahim4245
@mibrahim4245 2 жыл бұрын
Carbon made life easier when it comes to timing control !! .. I knew it in laravel , and now I use it even with php native :D .. Thanks !
@wahyusa
@wahyusa 2 жыл бұрын
Thank you!! Just saw your explanation and I realized that Carbon is exist and really powerfull
@nandopookey9195
@nandopookey9195 Жыл бұрын
Thank you so much sir
@rahulk6802
@rahulk6802 3 жыл бұрын
Absolutely fantastic....
@code-rookie-23
@code-rookie-23 3 жыл бұрын
thanks man, Keep doing again and again
@OnlineItSkills
@OnlineItSkills 4 жыл бұрын
very nicely explained great to be on your channel
@vincentspauwen5776
@vincentspauwen5776 3 жыл бұрын
Thank you fot the Video. What extension do you use to get the extra information inside the round brakcets like: ( value: 4) Regards
@LaravelDaily
@LaravelDaily 3 жыл бұрын
It's default PhpStorm.
@SreekalaA
@SreekalaA 4 жыл бұрын
Fantastic tricks , could have chkd this a week ago👌👌
@taoufiqbenmessaoud6270
@taoufiqbenmessaoud6270 4 жыл бұрын
Thank you for the video
@vipinfarswan6555
@vipinfarswan6555 4 жыл бұрын
Great Work.
@MashalMentor
@MashalMentor 4 жыл бұрын
Thank you so much. You are genius.
@marsianinm8349
@marsianinm8349 4 жыл бұрын
Thank you, the video is very good!
@jams1721
@jams1721 4 жыл бұрын
Great job!
@tgames3397
@tgames3397 3 жыл бұрын
very helpfull thank you
@stephtech1021
@stephtech1021 2 жыл бұрын
how can i create a coupon and add validity to expire after a certain date
@ajaykj8925
@ajaykj8925 2 жыл бұрын
I was trying to convert time from GI format to H:i . But it throws an error. My code is like Carbon: createFromFormat('Gi','900')->format ('H:i'); Pls help.
@jhosagidpirelapineda7808
@jhosagidpirelapineda7808 Жыл бұрын
Thanks.
@adnanzaib3374
@adnanzaib3374 4 жыл бұрын
How we can get last date of previous month based on user input field date. Date could be any of month,year. In laravel...
@agastyasutra
@agastyasutra 3 жыл бұрын
How to find difference between today and created at from database?
@LaravelDaily
@LaravelDaily 3 жыл бұрын
Here's the official docs on diff in Carbon: carbon.nesbot.com/docs/#api-difference
@dev.kardashov
@dev.kardashov 4 жыл бұрын
How to compare different tz in hours/days, etc. ?
@pauliusjankauskas8028
@pauliusjankauskas8028 4 жыл бұрын
I was wondering why you don't use "toDateTimeString()" function and still shows not full object of Carbon, but later i realized, that you're simply echoing (not dumping) info. So "echo" somehow convert as should be. But i wanted to ask another question: can we use "now()->toImmutable()" instead of using "now()->copy()"?
@ExpDev69
@ExpDev69 4 жыл бұрын
I am guessing "toImmutable()" makes the current Carbon instance immutable (you will not be able to modify it/it will return a new instance for each modification), while "copy()" just makes a new instance with the same properties. So to answer your question, yes, I think you can.
@PovilasKorop
@PovilasKorop 4 жыл бұрын
Yes, you can, both copy() and toImmutable() can work, depending on what you want to happen with original Carbon object and its copy.
@rafaelaltieris3414
@rafaelaltieris3414 Жыл бұрын
How I can format using Carbon?
@fulufheloful
@fulufheloful 4 жыл бұрын
I wish i knew about weekDays last week
@SanderCokart
@SanderCokart 2 жыл бұрын
So now to cover locale format :3
@alila3883
@alila3883 4 жыл бұрын
Nice
@bishalbhattarai9508
@bishalbhattarai9508 4 жыл бұрын
Sir please make video on websocket
@abunayem3415
@abunayem3415 4 жыл бұрын
i want to get from 2 date like [2020-12-01 2020-12-07] output: 2020-12-02,2020-12-03.....
@PovilasKorop
@PovilasKorop 4 жыл бұрын
Haven't tested, but should work as a loop. $array = []; $date = new Carbon('2020-12-01'); do { $array[] = $date->toDateString(); $date->addDay(); } while ($date->le(new Carbon('2020-12-06'))) Probably it's possible to do something quicker with Collections, but I don't have time to play around for more.
@abunayem3415
@abunayem3415 4 жыл бұрын
@@PovilasKorop thanks.
Laravel Validation: 12 Less-Known Tips in 13 Minutes
13:11
Laravel Daily
Рет қаралды 38 М.
Laravel: Create Public API with Cache and Rate Limits
12:18
Laravel Daily
Рет қаралды 47 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 646 М.
Top 10 Advanced CSS Responsive Design Concepts You Should Know
20:16
Web Dev Simplified
Рет қаралды 549 М.
The Easiest Way to Build Websites
10:56
Sajid
Рет қаралды 689 М.
5 tips for supercharged Laravel Eloquent queries
16:29
Andrew Schmelyun
Рет қаралды 68 М.
Exceptions in Laravel: Why/How to Use and Create Your Own
12:18
Laravel Daily
Рет қаралды 89 М.
Build an e-commerce site... with a twist - Web Dev Challenge S1E3
26:20
Learn With Jason
Рет қаралды 263 М.
AI is Taking JUNIOR Dev Jobs: What To Do?
8:06
Laravel Daily
Рет қаралды 2,4 М.
Laravel Eloquent: Deeper Relationships with One Query
10:37
Laravel Daily
Рет қаралды 146 М.
HashMaps & Dictionaries, Explained Simply
22:44
Nic Barker
Рет қаралды 11 М.
9 Tips for Shorter Laravel Code
10:16
Laravel Daily
Рет қаралды 62 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН