API documentation wrote:
Returns the hour represented by this Date object. The returned value is a number (0 through 23) representing the hour within the day that contains or begins with the instant in time represented by this Date object, as interpreted in the local time zone.
When you call getTime() on class Calendar, you get a Date object that represents the moment in time that the Calendar is set to. But since class Date doesn't know anything about time zones, the Date object doesn't know what time zone the Calendar object was set to.
kato Kwong wrote:Yes, so a Date is created with the value of the Calendar in GMT:
The class Date represents a specific instant in time, with millisecond precision...
The Date class is intended to reflect coordinated universal time (UTC)...
Some computer standards are defined in terms of Greenwich mean time (GMT), which is equivalent to universal time (UT). GMT is the "civil" name for the standard; UT is the "scientific" name for the same standard. The distinction between UTC and UT is that UTC is based on an atomic clock and UT is based on astronomical observations...
you could replace "Zulu" and "Asia/Calcutta" by two arbitrary other time zones and the assert will still pass
People sometimes ask question like "how do I get a Date object in some time zone" - well, you don't, because a Date doesn't know about time zones.
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter