PowerShell for Seasons

I wrote this little snippet to assist me with working out the current season (as in Spring, Summer, Autumn and Winter) with an accuracy of +/- 2 days. No, it’s not a method of calculating the exact time and date that the equinoxes will occur in a certain hemisphere but it’s good enough. I should mention that this is for the Northern Hemisphere so if you want one for the Southern Hemisphere, it should be pretty simple to work out what to change! The function will tell you the current season (if you don’t provide a date) or the season of a certain date you give it.

I looked at Wikipedia to see the next dates of the Equinoxes and they all fall on or around the dates below with an accuracy of +/- 2 days. If you want hyper-accuracy, don’t use this.

 

2 thoughts on “PowerShell for Seasons”

  1. Stating the obvious, one has to be aware of the local PC’s default locale date format and adjust the script accordingly. DD/MM vs MM/DD 🙂 Nice work.

Leave a Reply

Your email address will not be published. Required fields are marked *