Can you get the IRL Season?

I want to get the current season, but I don’t want to check if it’s September, October, or November to see if it’s Autumn. Any idea?

I think it would be difficult because it’s summer in Australia from December to February, but I have no idea if something like you describe would work.

You could try this:

local seasons = {"Winter", "Spring", "Summer", "Autumn"}

local date = os.date("*t", os.time()) --use !*t for global time
local month = date.month

function toSeason(month)
	--return seasons[1] only runs for december, because normally it's equal to nil.
	return seasons[math.floor(month/3)+1] or seasons[1]
end

print(toSeason(month))

although as @CSJeverything said there may be exclusions for places with opposite seasons.

3 Likes

All you need to do is flip the season in that case.

Yeah but there are a lot of scenarios that should be taken into consideration. For example there are places with less than 4 seasons or only 1, and you will probably have to use some kind of external API to find a season related to a users country(or make your own API). You can get the user region by using LocalizationService:GetCountryRegionForPlayerAsync(PlayerInstance).