Question

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?

Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top