{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4119","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4119/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4119/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4119/events","html_url":"https://github.com/astropy/astropy/issues/4119","id":104560652,"number":4119,"title":"Timezone convenience method for astropy.time.Time","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-09-02T20:03:32Z","updated_at":"2015-09-03T20:45:47Z","closed_at":null,"body":"Right now, if you want to get a localized datetime from an astropy time, you have to type a long string of calls to `pytz` like this: \r\n```python\r\n>>> import pytz\r\n>>> from astropy.time import Time\r\n>>> t = Time.now()\r\n>>> pytz.utc.localize(t.datetime).astimezone(pytz.timezone('US/Hawaii'))\r\ndatetime.datetime(2015, 9, 2, 9, 15, 26, 284400, tzinfo=<DstTzInfo 'US/Hawaii' HST-1 day, 14:00:00 STD>)\r\n```\r\n(localize the naive datetime as a UTC time, convert to another timezone with `pytz`). I’ve been thinking about how to make timezone manipulations more convenient in [astroplan](https://github.com/astropy/astroplan) and it seemed like this would be a convenient way to solve the problem also for other users outside of astroplan. \r\n\r\nAre there good reasons not to make a method on `astropy.time.Time` objects called `astimezone` that does what that last line does – accepting one argument that goes into the `datetime.astimezone` method and returning the result? For example, the above code would become: \r\n\r\n```python\r\n>>> t = Time.now()\r\n>>> timezone = pytz.timezone(\"US/hawaii\")\r\n>>> t.astimezone(timezone)\r\n```\r\n\r\nI tried to implement this, but the mysterious workings of `TimeFormat` prevented me. If this isn't a dumb idea, I'd love some advice on how to implement it. \r\n\r\ncc @taldcroft @mhvk "},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/137569522","html_url":"https://github.com/astropy/astropy/issues/4119#issuecomment-137569522","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4119","id":137569522,"user":{"login":"taldcroft","id":348089,"avatar_url":"https://avatars.githubusercontent.com/u/348089?v=3","gravatar_id":"","url":"https://api.github.com/users/taldcroft","html_url":"https://github.com/taldcroft","followers_url":"https://api.github.com/users/taldcroft/followers","following_url":"https://api.github.com/users/taldcroft/following{/other_user}","gists_url":"https://api.github.com/users/taldcroft/gists{/gist_id}","starred_url":"https://api.github.com/users/taldcroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taldcroft/subscriptions","organizations_url":"https://api.github.com/users/taldcroft/orgs","repos_url":"https://api.github.com/users/taldcroft/repos","events_url":"https://api.github.com/users/taldcroft/events{/privacy}","received_events_url":"https://api.github.com/users/taldcroft/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T20:45:47Z","updated_at":"2015-09-03T20:45:47Z","body":"@mhvk - your skeleton code looks great.\r\n@bmorris3 - go!  :smile:"}}