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.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton