Add files via upload

This commit is contained in:
Outis
2026-04-17 22:53:16 -04:00
committed by GitHub
parent de189dda3d
commit 44a26f48b3
+47
View File
@@ -0,0 +1,47 @@
#from suntime import Sun
#from datetime import datetime, timedelta
#import pytz
#latitude = YOUR_LATITUDE
#longitude = YOUR_LONGITUDE
#sun = Sun(latitude, longitude)
#tz = pytz.timezone(timezone)
# Get yesterday's date and time
#yesterday = datetime.now(tz) - timedelta(days=1)
#sunrise_time = sun.get_sunrise_time(yesterday).astimezone(tz)
# Print the sunrise time
#print(sunrise_time.strftime('%Y-%m-%d %H:%M:%S'))
from datetime import datetime, timedelta
import pytz
from suntime import Sun
# Example coordinates (e.g., New York City)
latitude = re.dacted
longitude = re.dacted
# Define the timezone
tz = pytz.timezone('America/New_York')
# Create a Sun object with the given latitude and longitude
sun = Sun(latitude, longitude)
# Get today's date and time in the desired timezone
now = datetime.now(tz)
# Get today's sunrise time in UTC and convert it to the desired timezone
sunrise_utc = sun.get_sunrise_time(now)
sunrise_time = sunrise_utc.astimezone(tz)
# Print the sunrise time in the desired format
print(sunrise_time.strftime('%Y-%m-%d %H:%M:%S'))