AgTalk Home
AgTalk Home
Search Forums | Classifieds (2) | Skins | Language
You are logged in as a guest. ( logon | register )

Spring is on the way
View previous thread :: View next thread
   Forums List -> AgTalk CafeMessage format
 
Chris
Posted 4/5/2024 07:25 (#10694471)
Subject: Spring is on the way



East central Iowa

At the time I post this it's only 348.677777 days away.

I wrote a python program to compute the days until spring, just for winter, but it keeps working.  If you want save it yourself, copy below, paste into notepad, save as  spring.py with notepad

_________________________________________________________________________________________

from datetime import datetime, timedelta, timezone
import time

def minutes_until_spring():
    # Get the current time in the central time zone
    central_timezone = timezone(timedelta(hours=-6))
    current_time = datetime.now(central_timezone)

    # Calculate the date of the spring equinox for the current year
    year = current_time.year
    spring_equinox = datetime(year, 3, 20, 4, 37, tzinfo=timezone.utc)  # Spring equinox is usually on March 20th at 4:37 UTC

    # If the spring equinox has already passed this year, calculate it for the next year
    if current_time > spring_equinox:
        year += 1
        spring_equinox = datetime(year, 3, 20, 4, 37, tzinfo=timezone.utc)

    # Calculate the time difference between now and the spring equinox
    time_until_spring = spring_equinox - current_time
    minutes_until_spring = int(time_until_spring.total_seconds() / 60)

    return minutes_until_spring

# Display the minutes until spring in the central time zone
minutes = minutes_until_spring()
print("Minutes until spring in the central time zone:", minutes)

# Wait for a response
input("Press Enter to get days until spring...")

#Calculate days by dividing  minutes
spring_days = (minutes / 60)/ 24
print("days",spring_days)

input("roughly  . . . .")

Top of the page Bottom of the page


Jump to forum :
Search this forum
Printer friendly version
E-mail a link to this thread

(Delete cookies)