I am using the Python Arrow package for formatting a date that I've got.
My input is:
datetime=2017-10-01T00:10:00Z and timezone=US/Pacific
My expected output is:
Sun 10/01 @ 6:10pm
I've tried a host of different date time conversions but I always end up with Sun 10/01 @ 12:10AM
which is not time zone dependent.
If I try and say:
x = arrow.Arrow.strptime('2017-10-01T00:10:00Z',
'%Y-%m-%dT%H:%M:%SZ',
tzinfo=tz.gettz('US/Pacific'))
x
is equal to:
<Arrow [2017-10-01T00:10:00-07:00]>
I then say:
x.strftime('%a %m/%d @ %I:%M%p')
and it outputs
Sun 10/01 @ 12:10AM
The Arrow
object knows about the timezone as evidenced by the -7:00
but does not format the date accordingly.
Any ideas?
I think that there are a couple of misunderstandings in this question.
Convert to a timezone
I can see no way that the timestamp,
Can become,
There are several problems here.
Zulu
aka GMT, so the timestamp already has a timezone.What does -7:00 mean?
So I am going to guess that what you intend is that the timestamp is in fact Zulu, and you want to display that timestamp as US/Pacific. If this is true than you need to do:
This results in:
You will note, as you noted earlier, that these produce the same time. The difference is that the first also has a -7:00. This does not indicate, as you intimated in your question, that time needs to have 7 hours removed to be shown as in the timezone, it instead indicates that the timestamp has already had 7 hours removed from Zulu.