Pergunta

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?

Foi útil?

Solução

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();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top