[ 
https://issues.apache.org/jira/browse/ARROW-637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15931331#comment-15931331
 ] 

Wes McKinney commented on ARROW-637:
------------------------------------

So it seems that we are well covered for if we have the two notions of:

* Time zone naive data (w/o time zone) -- no localization will occur when 
displaying these time stamps to the user
* Time zone aware data: data is internally normalized to UTC, but can be 
displayed as a localized timestamp to the user

I spent a bunch of time on this in pandas in 2012, here is how things work 
there:

{code:language=python}
In [4]: import pandas as pd

In [5]: stamp = pd.Timestamp('2000-01-01 00:00:00')

In [6]: stamp.value  # nanoseconds
Out[6]: 946684800000000000

In [7]: stamp_as_utc = stamp.tz_localize('utc')

In [8]: stamp_as_utc
Out[8]: Timestamp('2000-01-01 00:00:00+0000', tz='UTC')

In [9]: stamp_as_utc.value
Out[9]: 946684800000000000

In [10]: stamp_as_eastern = stamp_as_utc.tz_convert('America/New_York')

In [11]: stamp_as_eastern
Out[11]: Timestamp('1999-12-31 19:00:00-0500', tz='America/New_York')

In [12]: stamp_as_eastern.value
Out[12]: 946684800000000000

In [13]: stamp_as_eastern.year
Out[13]: 1999

In [14]: stamp_as_eastern.month
Out[14]: 12

In [15]: stamp_as_eastern.hour
Out[15]: 19
{code}

Here, you can see the physical int64 value is the same in all cases, but we 
have 3 different notions: tz-naive ({{stamp}} has no time zone), with UTC, with 
a particular local time zone -- but the tz is used for display only and 
computing day/month/year/hms components



> [Format] Add time zone metadata to Timestamp type
> -------------------------------------------------
>
>                 Key: ARROW-637
>                 URL: https://issues.apache.org/jira/browse/ARROW-637
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Format
>            Reporter: Wes McKinney
>            Assignee: Wes McKinney
>
> As a metadata-only convenience, it would be useful to have an optional Olson 
> time zone name or absolute time offset (e.g. {{+07:30}}) in the {{Timestamp}} 
> flatbuffers type: 
> https://github.com/apache/arrow/blob/master/format/Message.fbs#L94
> Null or length-0 string would indicate that the data is time zone naive, and 
> shall not be considered to be localized. 
> https://github.com/apache/arrow/pull/388



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to