You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@asterixdb.apache.org by Preston Carman <pr...@apache.org> on 2016/06/05 22:03:58 UTC

Datetime to Unix Timestamp

Is there a way to get the Unix timestamp of a datetime value? The data
is stored in this way. We have several functions to take a UNIX
timestamp and create an AsterixDB datetime value, but do we have the
other way around?

Possible functions
UNIX_TIME_FROM_DATETIME_IN_MS
UNIX_TIME_FROM_DATETIME_IN_SECS

Thoughts on adding these functions?

Just wanted to check to see if I was missing the way method to get a
Unix timestamp or it was actually missing.

Thanks
Preston

Re: Datetime to Unix Timestamp

Posted by Preston Carman <pr...@apache.org>.
It would be nice to be able to get the numeric value used to store the
different time units. It seems that UNIX timestamp only refers to
datetime in seconds. Although the datetime format in AsterixDB is
stores a datetime in milliseconds. We could come up with a better
function name. These are the ones I am using in the current patch.

UNIX_TIME_FROM_DATE_IN_DAYS
UNIX_TIME_FROM_DATETIME_IN_SECS
UNIX_TIME_FROM_DATETIME_IN_MS
UNIX_TIME_FROM_TIME_IN_SECS

On Tue, Jun 7, 2016 at 5:23 AM, Till Westmann <ti...@apache.org> wrote:
> I think that it’s fine to add a function for this. However, AFAIK the UNIX
> timestamp is in seconds [1], so it seems that we don’t need functions for
> different time units.
>
> Is there a reason why we should support different time units?
>
> Cheers,
> Till
>
> [1] https://en.wikipedia.org/wiki/Unix_time
>
> On 6 Jun 2016, at 3:08, Ian Maxon wrote:
>
>> I don't think so. The other way around (timestamp to datetime) only existed
>> until relatively recently. I never made the other way around, or at least I
>> don't recall doing it.
>>
>> On Sun, Jun 5, 2016 at 3:03 PM, Preston Carman <pr...@apache.org> wrote:
>>
>>> Is there a way to get the Unix timestamp of a datetime value? The data
>>> is stored in this way. We have several functions to take a UNIX
>>> timestamp and create an AsterixDB datetime value, but do we have the
>>> other way around?
>>>
>>> Possible functions
>>> UNIX_TIME_FROM_DATETIME_IN_MS
>>> UNIX_TIME_FROM_DATETIME_IN_SECS
>>>
>>> Thoughts on adding these functions?
>>>
>>> Just wanted to check to see if I was missing the way method to get a
>>> Unix timestamp or it was actually missing.
>>>
>>> Thanks
>>> Preston
>>>

Re: Datetime to Unix Timestamp

Posted by Till Westmann <ti...@apache.org>.
I think that it\u2019s fine to add a function for this. However, AFAIK the UNIX
timestamp is in seconds [1], so it seems that we don\u2019t need functions for
different time units.

Is there a reason why we should support different time units?

Cheers,
Till

[1] https://en.wikipedia.org/wiki/Unix_time

On 6 Jun 2016, at 3:08, Ian Maxon wrote:

> I don't think so. The other way around (timestamp to datetime) only existed
> until relatively recently. I never made the other way around, or at least I
> don't recall doing it.
>
> On Sun, Jun 5, 2016 at 3:03 PM, Preston Carman <pr...@apache.org> wrote:
>
>> Is there a way to get the Unix timestamp of a datetime value? The data
>> is stored in this way. We have several functions to take a UNIX
>> timestamp and create an AsterixDB datetime value, but do we have the
>> other way around?
>>
>> Possible functions
>> UNIX_TIME_FROM_DATETIME_IN_MS
>> UNIX_TIME_FROM_DATETIME_IN_SECS
>>
>> Thoughts on adding these functions?
>>
>> Just wanted to check to see if I was missing the way method to get a
>> Unix timestamp or it was actually missing.
>>
>> Thanks
>> Preston
>>

Re: Datetime to Unix Timestamp

Posted by Ian Maxon <im...@uci.edu>.
I don't think so. The other way around (timestamp to datetime) only existed
until relatively recently. I never made the other way around, or at least I
don't recall doing it.

On Sun, Jun 5, 2016 at 3:03 PM, Preston Carman <pr...@apache.org> wrote:

> Is there a way to get the Unix timestamp of a datetime value? The data
> is stored in this way. We have several functions to take a UNIX
> timestamp and create an AsterixDB datetime value, but do we have the
> other way around?
>
> Possible functions
> UNIX_TIME_FROM_DATETIME_IN_MS
> UNIX_TIME_FROM_DATETIME_IN_SECS
>
> Thoughts on adding these functions?
>
> Just wanted to check to see if I was missing the way method to get a
> Unix timestamp or it was actually missing.
>
> Thanks
> Preston
>