Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 2 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Carbon
  2. [![Latest Stable Version](https://img.shields.io/packagist/v/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon)
  3. [![Total Downloads](https://img.shields.io/packagist/dt/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon)
  4. [![Build Status](https://img.shields.io/travis/briannesbitt/Carbon/master.svg?style=flat-square)](https://travis-ci.org/briannesbitt/Carbon)
  5. [![StyleCI](https://styleci.io/repos/5724990/shield?style=flat-square)](https://styleci.io/repos/5724990)
  6. [![codecov.io](https://img.shields.io/codecov/c/github/briannesbitt/Carbon.svg?style=flat-square)](https://codecov.io/github/briannesbitt/Carbon?branch=master)
  7. [![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat-square)](https://github.com/phpstan/phpstan)
  8. [![Tidelift](https://tidelift.com/badges/github/briannesbitt/Carbon)](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme)
  9. An international PHP extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com)
  10. ```php
  11. use Carbon\Carbon;
  12. printf("Right now is %s", Carbon::now()->toDateTimeString());
  13. printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString()
  14. $tomorrow = Carbon::now()->addDay();
  15. $lastWeek = Carbon::now()->subWeek();
  16. $nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4);
  17. $officialDate = Carbon::now()->toRfc2822String();
  18. $howOldAmI = Carbon::createFromDate(1975, 5, 21)->age;
  19. $noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London');
  20. $internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT');
  21. // Don't really want this to happen so mock now
  22. Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1));
  23. // comparisons are always done in UTC
  24. if (Carbon::now()->gte($internetWillBlowUpOn)) {
  25. die();
  26. }
  27. // Phew! Return to normal behaviour
  28. Carbon::setTestNow();
  29. if (Carbon::now()->isWeekend()) {
  30. echo 'Party!';
  31. }
  32. // Over 200 languages (and over 500 regional variants) supported:
  33. echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago'
  34. echo Carbon::now()->subMinutes(2)->locale('zh_CN')->diffForHumans(); // '2分钟前'
  35. echo Carbon::parse('2019-07-23 14:51')->isoFormat('LLLL'); // 'Tuesday, July 23, 2019 2:51 PM'
  36. echo Carbon::parse('2019-07-23 14:51')->locale('fr_FR')->isoFormat('LLLL'); // 'mardi 23 juillet 2019 14:51'
  37. // ... but also does 'from now', 'after' and 'before'
  38. // rolling up to seconds, minutes, hours, days, months, years
  39. $daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays();
  40. ```
  41. [Get supported nesbot/carbon with the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme)
  42. ## Installation
  43. ### With Composer
  44. ```
  45. $ composer require nesbot/carbon
  46. ```
  47. ```json
  48. {
  49. "require": {
  50. "nesbot/carbon": "^2.16"
  51. }
  52. }
  53. ```
  54. ```php
  55. <?php
  56. require 'vendor/autoload.php';
  57. use Carbon\Carbon;
  58. printf("Now: %s", Carbon::now());
  59. ```
  60. <a name="install-nocomposer"/>
  61. ### Without Composer
  62. Why are you not using [composer](http://getcomposer.org/)? Download the Carbon [latest release](https://github.com/briannesbitt/Carbon/releases) and put the contents of the ZIP archive into a directory in your project. Then require the file `autoload.php` to get all classes and dependencies loaded on need.
  63. ```php
  64. <?php
  65. require 'path-to-Carbon-directory/autoload.php';
  66. use Carbon\Carbon;
  67. printf("Now: %s", Carbon::now());
  68. ```
  69. ## Docs
  70. [http://carbon.nesbot.com/docs](http://carbon.nesbot.com/docs)
  71. ## Security contact information
  72. To report a security vulnerability, please use the
  73. [Tidelift security contact](https://tidelift.com/security).
  74. Tidelift will coordinate the fix and disclosure.
  75. ## Credits
  76. ### Contributors
  77. This project exists thanks to all the people who contribute.
  78. <a href="https://github.com/briannesbitt/Carbon/graphs/contributors" target="_blank"><img src="https://opencollective.com/Carbon/contributors.svg?width=890&button=false" /></a>
  79. ### Translators
  80. [Thanks to people helping us to translate Carbon in so many languages](https://carbon.nesbot.com/contribute/translators/)
  81. ### Backers
  82. Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Carbon#backer)]
  83. <a href="https://opencollective.com/Carbon#backers" target="_blank"><img src="https://opencollective.com/Carbon/backers.svg?width=890"></a>
  84. ### Sponsors
  85. Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Carbon#sponsor)]
  86. <a href="https://opencollective.com/Carbon/sponsor/0/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/0/avatar.svg"></a>
  87. <a href="https://opencollective.com/Carbon/sponsor/1/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/1/avatar.svg"></a>
  88. <a href="https://opencollective.com/Carbon/sponsor/2/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/2/avatar.svg"></a>
  89. <a href="https://opencollective.com/Carbon/sponsor/3/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/3/avatar.svg"></a>
  90. <a href="https://opencollective.com/Carbon/sponsor/4/website" target="_blank"><img src="https://opencollective.com/Carbon/sponsor/4/avatar.svg"></a>