I don't know what you are trying to do here, but this statement is not correct. A Date object simply contains a number of milliseconds since a certain point in time. You may interpret that Date as being in a certain timezone when you format it to a String, but the Date itself does not have a timezone and knows nothing of timezones. And following on from that, the signature of that method doesn't make any sense. If it returned a String, that would make sense. It would look like this:I have created the following method to return a Date object that contains the time local to a timezone.
You can want that all you want, but that isn't how Date works. All you can actually have is that the Date object represents the current time. If you want to know what that time is in a particular timezone, then you have to format it as a String using code already posted in this thread.Originally posted by Mike Broadbear:
Well, I can restate. I want whatever the Date object contains to reprepsent the current time in the timezone denoted in the single String argument.
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|