문제

I have a project that I need to determine the Time Zone for. The TimeZone class seems perfect for the task:

import java.util.TimeZone;

long tzo = TimeZone.getRawOffset();

However, The getRawOffset method is not available. What am I not understanding?

도움이 되었습니까?

해결책

getRawOffset() isn't static, so you can't call it on TimeZone. Instead you need an actual TimeZone object.

Probably something like:

int tzo = TimeZone.getDefault().getRawOffset();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top