Frage

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?

War es hilfreich?

Lösung

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();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top