I would like to know if there is some easy way to identify seasons: spring, summer, autumn or winter. I’m have to generate a ‘resume’ and I’d like that if a period of working roughly fits a season (not exactly but with a +/-10 days error for example) it returns spring, summer, autumn or winter.
Like:
- input: 25/06/2010, 30/09/2010
- output: Summer 2010
(In Spain summer is between 21 July and 20 September)
- input: 02/02/2009, 30/04/2010
- output: 2009-2010
Any idea how to do this?
As you are looking for a season for a period I quickly wrote this function, it can be improve and may have some bugs but you have somewhere to start.
Result:
And the except you want for “season year overflow”:
Instead of:
Note: Winter is coming.