Question

How to determine whether current month is a summer or winter from GMT date.

Suppose we are in may, how to determine if may is a summer month or winter month for the current year.

DateTimeZone franceZone = DateTimeZone.ForId("Europe/France");

DateTimeZone localZone = DateTimeZone.SystemDefault;
ZonedDateTime utc = new ZonedDateTime(2014, 05, 15, 9, 0, 0, DateTimeZone.CEST);
ZonedDateTime france = new ZonedDateTime(CEST.ToInstant(), franceZone);
Console.WriteLine(france.LocalDateTime);
Was it helpful?

Solution

Create two arrayslists
1- Summer months 2- Winter months

When you retrieve the month value from GMT date run a check through the arraylist to see which array the value matches.

for (String s : arrayList)
    if (s.equals(value)){
 season= winter
}

Maybe something like that pseudo code

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top