문제

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);
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top