Specific function method:
Current time
Carbon::now();
One week ago
Carbon::now()- >subWeek();
Vancouver time
Carbon::now('America/Vancouver');
Calculate age
Carbon::createFromDate (1984, 8, 28)->age;
Determine whether it is a weekend
Carbon::now()->isWeekend();
Number of days per month
Carbon::now()->daysInMonth;
What day is today
Carbon::now()->dayOfWeek;
一Day of the year
Carbon::now()->dayOfYear;
1 hour
Carbon::now()->addHour(1) );
1 minute
Carbon::now()->addMinute(1);
1 day
Carbon::now() ->addDay(1);
1 week.
Carbon::now()->addWeek(1);
Tomorrow
Carbon::now()->tomorrow();//Tomorrow
-1 hour
Carbon::now()->subHour();
Whether Monday
Carbon::now()->isMonday()
The last day of the month
Carbon::now()->lastOfMonth();
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
![Memcache vs. Memcached: Which PHP Library Should You Choose?](https://img.php.cn/upload/article/001/246/273/173112768360823.jpg)
09 Nov 2024
Distinguishing "Memcache" and "Memcached" in PHPPHP offers two memcached libraries: memcache and memcached. Understanding their differences helps...
![How Do I Link Static Libraries That Depend on Other Static Libraries?](https://img.php.cn/upload/article/001/246/273/173408941480807.jpg)
13 Dec 2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...
![Memcache vs Memcached: Which PHP Memcached Library Should You Choose?](https://img.php.cn/upload/article/001/246/273/173202768439255.jpg)
19 Nov 2024
Memcache vs Memcached: Choosing the Right PHP Memcached LibraryIntroductionPHP offers two seemingly similar memcached libraries: memcache and...
![Which PHP Library Best Fits Your Email Address Validation Needs?](https://img.php.cn/upload/article/001/246/273/173188824365387.jpg)
18 Nov 2024
PHP Email Address Validation Libraries UncoveredEmail address validation plays a crucial role in data validation, but creating a...
06 Jul 2016
I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class? I personally prefer the .class.php form, because in some frameworks, after importing third-party class libraries and specifying class libraries...
![Memcache vs. Memcached: Which PHP Caching Library Should You Choose?](https://img.php.cn/upload/article/001/246/273/173136990313411.jpg)
12 Nov 2024
Memcache vs. Memcached: Choosing the Right PHP Library for Your Cache NeedsIn the realm of PHP caching libraries, Memcache and Memcached stand out...
![](/static/imghw/down_right.png)
![](/static/imghw/taglogo.png)
Hot Tools
![PHP library for dependency injection containers](https://img.php.cn/upload/manual/000/000/001/5e2171bf3c005481.png)
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images
![](/static/imghw/taglogo.png)