Calculator
Using the Zodiac Calculator Class
4k Downloads / Month
Open Source MIT License
4k Downloads / Month
Open Source MIT License
Learn how to use the Zodiac Calculator Class to transform different date formats into zodiac sign objects including reading from scalar date types or date objects.
The calculator class can read dates from integer types (unix timestamp) as
well as text strings, which can represent a relative time (last monday
,
tomorrow
, last day of next month
), an absolute time (first day of June 1983
,
2011-11-11
) or an unix timestamp as string.
use Intervention\Zodiac\Calculator;
// create from iso date
$zodiac = Calculator::zodiac('1992-03-19');
// create from relative date
$zodiac = Calculator::zodiac('first day of June 2008');
// create from unix timestamp integer
$zodiac = Calculator::zodiac(1641719287);
You can also pass date objects (DateTime
or Carbon
) to instantiate new zodiac objects.
use Intervention\Zodiac\Calculator;
use Carbon\Carbon;
// create from datetime objects
$zodiac = Calculator::zodiac(new DateTime('1977-03-15'));
// create from carbon objects
$zodiac = Calculator::zodiac(Carbon::yesterday());
Continue reading to learn what you can do with the zodiac objects.
Edit