when trying to get $zmanim->getSunsetOffsetByDegrees(8.0); I dont get a result back.
<?php
// Include Composer's autoloader
require 'vendor/autoload.php';
// Use necessary classes from PhpZmanim and Carbon
use PhpZmanim\Zmanim;
use PhpZmanim\Calendar\ComplexZmanimCalendar;
use PhpZmanim\Geo\GeoLocation;
use PhpZmanim\Calculator\SunTimesCalculator; // Switch to SunTimesCalculator
// Create a GeoLocation object
$geoLocation = new GeoLocation($locationName, $lat, $long, $elevation, $timeZone);
// Create a ComplexZmanimCalendar object for the specified date
$calendar = new ComplexZmanimCalendar($geoLocation);
// $calendar->setAstronomicalCalculator(new NoaaCalculator()); // Ensure NOAA calculator
$calendar->setDate($getyear, $getmonth, $getday);
// Now get all the desired Zmanim
$alos72 = $calendar->getAlosHashachar(); // 72 minutes before sunrise (Alos Hashachar)
$sunrise = $calendar->getSunrise(); // Sunrise
$sofZmanShmaMGA = $calendar->getSofZmanShmaMGA(); // Latest time for Krias Shma according to Magen Avraham
$sofZmanShmaGra = $calendar->getSofZmanShmaGRA(); // Latest time for Krias Shma according to the Gra
$sofZmanTfilaMGA = $calendar->getSofZmanTfilaMGA(); // Latest time for Tefilah according to Magen Avraham
$sofZmanTfilaGra = $calendar->getSofZmanTfilaGRA(); // Latest time for Tefilah according to the Gra
$chatzos = $calendar->getChatzos(); // Midday (Chatzos)
$minchaGedola = $calendar->getMinchaGedola(); // Earliest Mincha (Mincha Gedola)
$minchaKetana = $calendar->getMinchaKetana(); // Latest time for Mincha (Mincha Ketana)
$plagHamincha = $calendar->getPlagHamincha(); // Plag Hamincha (1.25 hours before sunset)
$sunset = $calendar->getSunset(); // Sunset
$tzais = $calendar->getTzaisGeonim7Point083Degrees(); // Nightfall (Tzais)
$eightDegreesTime = $calendar->getSunsetOffsetByDegrees(8.0);
// Output the Zmanim times
echo "Zmanim (Times for different Zmanim for {$getyear}-{$getmonth}-{$getday}):\n";
print_r($times);
can anyone help with what I am doing wrong please?
use PhpZmanim\Calendar\AstronomicalCalendar;
$alosTwo = $calendar->getSunriseOffsetByDegrees(AstronomicalCalendar::GEOMETRIC_ZENITH + 12);
for those who are having a similar issue this is the way to do it
when trying to get $zmanim->getSunsetOffsetByDegrees(8.0); I dont get a result back. <?php
// Include Composer's autoloader require 'vendor/autoload.php';
// Use necessary classes from PhpZmanim and Carbon use PhpZmanim\Zmanim; use PhpZmanim\Calendar\ComplexZmanimCalendar; use PhpZmanim\Geo\GeoLocation; use PhpZmanim\Calculator\SunTimesCalculator; // Switch to SunTimesCalculator
use Carbon\Carbon;
// Example: Define location (latitude, longitude, elevation, timezone) $locationName = "Manchester"; $lat = 53.521;
$long = -2.263; $elevation = 0; $timeZone = "Europe/London"; $getyear = date("Y"); $getday = date("d"); $getmonth = date("m");
date_default_timezone_set($timeZone);
// Create a GeoLocation object $geoLocation = new GeoLocation($locationName, $lat, $long, $elevation, $timeZone);
// Create a ComplexZmanimCalendar object for the specified date $calendar = new ComplexZmanimCalendar($geoLocation); // $calendar->setAstronomicalCalculator(new NoaaCalculator()); // Ensure NOAA calculator
$calendar->setDate($getyear, $getmonth, $getday);
// Now get all the desired Zmanim $alos72 = $calendar->getAlosHashachar(); // 72 minutes before sunrise (Alos Hashachar) $sunrise = $calendar->getSunrise(); // Sunrise $sofZmanShmaMGA = $calendar->getSofZmanShmaMGA(); // Latest time for Krias Shma according to Magen Avraham $sofZmanShmaGra = $calendar->getSofZmanShmaGRA(); // Latest time for Krias Shma according to the Gra $sofZmanTfilaMGA = $calendar->getSofZmanTfilaMGA(); // Latest time for Tefilah according to Magen Avraham $sofZmanTfilaGra = $calendar->getSofZmanTfilaGRA(); // Latest time for Tefilah according to the Gra $chatzos = $calendar->getChatzos(); // Midday (Chatzos) $minchaGedola = $calendar->getMinchaGedola(); // Earliest Mincha (Mincha Gedola) $minchaKetana = $calendar->getMinchaKetana(); // Latest time for Mincha (Mincha Ketana) $plagHamincha = $calendar->getPlagHamincha(); // Plag Hamincha (1.25 hours before sunset) $sunset = $calendar->getSunset(); // Sunset $tzais = $calendar->getTzaisGeonim7Point083Degrees(); // Nightfall (Tzais) $eightDegreesTime = $calendar->getSunsetOffsetByDegrees(8.0);
// Format the times and output them $times = [ 'Alos 72' => $alos72 ? $alos72->format('H:i') : 'Not available', 'Sunrise' => $sunrise ? $sunrise->format('H:i') : 'Not available', 'Sof Zman Shma MGA' => $sofZmanShmaMGA ? $sofZmanShmaMGA->format('H:i') : 'Not available', 'Sof Zman Shma Gra' => $sofZmanShmaGra ? $sofZmanShmaGra->format('H:i') : 'Not available', 'Sof Zman Tfila MGA' => $sofZmanTfilaMGA ? $sofZmanTfilaMGA->format('H:i') : 'Not available', 'Sof Zman Tfila Gra' => $sofZmanTfilaGra ? $sofZmanTfilaGra->format('H:i') : 'Not available', 'Chatzos' => $chatzos ? $chatzos->format('H:i') : 'Not available', 'Mincha Gedola' => $minchaGedola ? $minchaGedola->format('H:i') : 'Not available', 'Mincha Ketana' => $minchaKetana ? $minchaKetana->format('H:i') : 'Not available', 'Plag Hamincha' => $plagHamincha ? $plagHamincha->format('H:i') : 'Not available', 'Sunset' => $sunset ? $sunset->format('H:i') : 'Not available', 'Tzais' => $tzais ? $tzais->format('H:i') : 'Not available', 'Shabbos Out' => $eightDegreesTime ? $eightDegreesTime->format('H:i') : 'Not available', ];
// Output the Zmanim times echo "Zmanim (Times for different Zmanim for {$getyear}-{$getmonth}-{$getday}):\n"; print_r($times); can anyone help with what I am doing wrong please?