Android Programming
The following code int year = new Time().year;is returning value of year with default zone. So I am getting 1970 as the return value for year.
Whein I use the following constructor with field year String zone=new Time().timezone;
int year = new Time(zone).year;
I am getting the value for zone as ASIA/Calcutta but for year value I am still getting 1970 only. May I know why I am not getting the present year? Is there any other way to achieve the same?
Check
timezoneIDisAsia/Calcutta.If you are Asia/Calcutta timezone But if you are not and want to set just set LikeTimeZone est = TimeZone.getTimeZone( "Asia/Calcutta" );otherwise Use Below….