using Innovative.SolarCalculator;
using Innovative.Geometry;
public static DateTime AngleTime(Angle angle, SolarTimes sunDetails)
DateTimeOffset zman = new DateTimeOffset(sunDetails.ForDate.Ticks, sunDetails.ForDate.Offset);
if (sunDetails.SolarElevation < (double)-3)
while (sunDetails.SolarElevation <= angle)
zman = zman.AddMinutes(1);
sunDetails.ForDate = zman;
while (sunDetails.SolarElevation >= angle)
zman = zman.AddMinutes(1);
sunDetails.ForDate = zman;
return new DateTime(zman.Ticks);
public static void Main()
TimeSpan offset = new TimeSpan(TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow, "Israel Standard Time").Offset.Ticks);
DateTimeOffset localDate = new DateTimeOffset(DateTime.Today.Ticks, offset);
SolarTimes sunSolar = new SolarTimes(DateTime.Today.AddHours(-2), 32.109333, 34.855499);
DateTime sunrise1 = sunSolar.Sunrise;
DateTime sunset1 = sunSolar.Sunset;
DateTime sunrise = new DateTime(2023,02,26,06,12,00);
DateTime sunset = new DateTime(2023,02,26,17,36,00);
TimeSpan difference = sunset.Subtract(sunrise);
double differenceInMin = difference.TotalMinutes;
TimeSpan TempHour = TimeSpan.FromMinutes(((differenceInMin) / 12));
TimeSpan TempMin = TimeSpan.FromMinutes(TempHour.TotalMinutes / 60);
DateTime alotHashar = sunrise.Add(-72*TempMin);
DateTime talitAndTfilin = sunrise.Add(-66*TempMin);
Console.WriteLine("Temp H:" + TempHour);
Console.WriteLine(alotHashar);
Console.WriteLine(talitAndTfilin);
Console.WriteLine(sunrise);
Console.WriteLine(sunset);
Console.WriteLine(sunrise1);
Console.WriteLine(sunset1);