From user-return-63661-archive-asf-public=cust-asf.ponee.io@cassandra.apache.org Fri Apr 12 08:15:32 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6ADD7180621 for ; Fri, 12 Apr 2019 10:15:32 +0200 (CEST) Received: (qmail 12968 invoked by uid 500); 12 Apr 2019 08:15:25 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 12936 invoked by uid 99); 12 Apr 2019 08:15:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2019 08:15:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7AB27C5713 for ; Fri, 12 Apr 2019 08:15:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.3 X-Spam-Level: ** X-Spam-Status: No, score=2.3 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, KAM_NUMSUBJECT=0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=instaclustr.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id WQbIWt0KECjS for ; Fri, 12 Apr 2019 08:15:19 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id B05715FB83 for ; Fri, 12 Apr 2019 08:15:18 +0000 (UTC) Received: by mail-wr1-f54.google.com with SMTP id w10so10755968wrm.4 for ; Fri, 12 Apr 2019 01:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=instaclustr.com; s=instaclustr.email.auth; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=mMck3Udzmu2ycWbIUTI7D2aG0KUAP83By/n1Mt6NTp8=; b=aA9BmsD6sUDjoIHKsg3VRegailf9cFLqU0BODdxOBNf9ovz4Wgodbo68qBGLNmCmS2 EYQpOKxu4j19mihR7Wv6XIh3cpIo0ynl4obKurE3O1AKGDTqEbsFs0wJoSPFxa8bdJXu eZQsfdhCL616G8vylUnZAO1zKb9RCwJxcAbJY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=mMck3Udzmu2ycWbIUTI7D2aG0KUAP83By/n1Mt6NTp8=; b=KGvDVy8eTUJrXbBMBaMV9ZusGqbgstuWyx5iv52yGlMZEpydBD97KR0us+DxTAIKdE 1Q0oVTlmsOQ0gmbqh6yzqvCtH8I3/mgZh0Mnm9NtoVmlMDNyM65qU9CNWtH9tUVcHkmq 8PXPGuQaYNRGRWe+yK8SV3mpuJ4gQIhicIQ5pZeEXYLnLJdKzdI5l7HuaaAN7j0zjmpA 67A9opVoEh/ijEQyoHSqUDG3XfUJIuISa1hocupiEgZbL/7OREFig1Es9GYijzDoly0x oB8ArwYeGXtviRVjUVeYQFKxBuWgbyLscNAwdmzgwAXj9jmPoCzcTj81E5mpy81jT6vb 98gQ== X-Gm-Message-State: APjAAAWQgL0rn8yycyX4x4Mnym3t/APYxJV1yJRRC7B7vNXHPbNZwXaS l+b9wwXPSumEsp10C/Gp+aZBGLAQGRIQgQ== X-Google-Smtp-Source: APXvYqxCUYqKk5/FxutkF05/b/3wc+xI/iYqdPsBrgPOKvVymHJk16jNy6tIYqU83Gqwu4wRCq36xQ== X-Received: by 2002:adf:f110:: with SMTP id r16mr33326367wro.153.1555056917417; Fri, 12 Apr 2019 01:15:17 -0700 (PDT) Received: from [192.168.0.28] (cpc96818-rdng27-2-0-cust678.15-3.cable.virginm.net. [86.30.202.167]) by smtp.gmail.com with ESMTPSA id w10sm27719834wrv.8.2019.04.12.01.15.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 01:15:16 -0700 (PDT) From: Alok Dwivedi Content-Type: multipart/alternative; boundary="Apple-Mail=_B48CFC15-E907-45E7-9A57-8D834FDC38D4" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: how to store date before > 1970 Date: Fri, 12 Apr 2019 09:15:16 +0100 References: To: user@cassandra.apache.org In-Reply-To: Message-Id: <7915BC83-974E-4E76-BB00-A03B29839A5E@instaclustr.com> X-Mailer: Apple Mail (2.3445.104.8) --Apple-Mail=_B48CFC15-E907-45E7-9A57-8D834FDC38D4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 You should be able to use timestamp or date for dates before 1970. Here = is an example CREATE TABLE test_ts_date (id int, ts timestamp, dt date, value text, = PRIMARY KEY (id, ts)); =20 INSERT INTO test_ts_date (id, ts, dt, value) VALUES (1, '2019-04-11 = 01:20:30', '2019-04-11', 'value1'); INSERT INTO test_ts_date (id, ts, dt, value) VALUES ( 1, '2014-02-12 = 03:15:30', '2014-02-12', 'Value3'); INSERT INTO test_ts_date (id, ts, dt, value) VALUES ( 1, '1960-02-12 = 05:25:33', '1960-02-12', 'Value1 for ts before 1970'); INSERT INTO test_ts_date (id, ts, dt, value) VALUES ( 1, -2522680400000, = '1890-22-01', 'Value2 for negative ts'); select * from test_ts_date ; id | ts | dt | value = ----+---------------------------------+------------+----------------------= ----- 1 | -2522680400000 | 1890-01-22 | Value2 for = negative ts 1 | 1960-02-12 05:25:33.000000+0000 | 1960-02-12 | Value1 for ts = before 1970 1 | 2014-02-12 03:15:30.000000+0000 | 2014-02-12 | = Value3 1 | 2019-04-11 01:20:30.000000+0000 | 2019-04-11 | = value1 You can choose either of timestamp or date based on what precision you = want. They both can take values before 1970. I think there might be = issue sending negative long for timestamps from Java driver (I haven=E2=80= =99t tried that) but passing dates before 1970 should be fine. Some = related tickets for reference.=20 https://datastax-oss.atlassian.net/browse/JAVA-264 = https://datastax-oss.atlassian.net/browse/JAVA-313 = Thanks Alok Dwivedi Senior Consultant=20 https://www.instaclustr.com/ > On 12 Apr 2019, at 07:25, adrien ruffie = wrote: >=20 > Hello all, >=20 > I have a tricky question about "how to store a date" if dates can be a = date prior to 1970 ? > I checked the potential data type and found timestamp and date but = both begin to the epoch (January 1, 1970) ... >=20 > If I want to store oldest dating, which data type and means I can use = ? >=20 > Thank you and best regards, >=20 > Adrien --Apple-Mail=_B48CFC15-E907-45E7-9A57-8D834FDC38D4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
You should be = able to use timestamp or date for dates before 1970. Here is an = example
CREATE TABLE test_ts_date = (id int, ts timestamp, dt date, value text, PRIMARY KEY (id, ts)); =  
INSERT INTO test_ts_date (id, ts, dt, value) = VALUES (1, '2019-04-11 01:20:30', '2019-04-11', 'value1');
INSERT INTO test_ts_date (id, ts, dt, value) VALUES ( 1, = '2014-02-12 03:15:30', '2014-02-12', 'Value3');
INSERT INTO test_ts_date (id, ts, dt, value) VALUES ( 1, = '1960-02-12 05:25:33', '1960-02-12', 'Value1 for ts before = 1970');
INSERT INTO test_ts_date (id, ts, dt, = value) VALUES ( 1, -2522680400000, '1890-22-01', 'Value2 for negative = ts');

select = * from test_ts_date ;

 id | = ts  =                     =         | dt   =       | value
----+---------------------------------+------------+-----------= ----------------
  1 |          =         -2522680400000 | 1890-01-22 = |    Value2 for = negative ts
  1 | 1960-02-12 05:25:33.000000+0000 | 1960-02-12 | Value1 for = ts before 1970
  1 | 2014-02-12 03:15:30.000000+0000 | 2014-02-12 |                =     Value3
  1 | 2019-04-11 = 01:20:30.000000+0000 | 2019-04-11 |      =               value1


You can choose either of timestamp or = date based on what precision you want. They both can take values before = 1970. I think there might be issue sending negative long for timestamps = from Java driver (I haven=E2=80=99t tried that) but passing dates before = 1970 should be fine. Some related tickets for reference. 
https://datastax-oss.atlassian.net/browse/JAVA-264https://datastax-oss.atlassian.net/browse/JAVA-313
Thanks
Alok Dwivedi
Senior Consultant 




On 12 Apr 2019, at 07:25, adrien ruffie <adriennolarsen@hotmail.fr> wrote:

Hello all,

I have a tricky question about "how to store a date" if dates = can be a date prior to 1970 ?
I checked the = potential data type and found timestamp and date but both begin to the = epoch (January 1, 1970) ...

If I want to store oldest dating, which = data type and means I can use ?

Thank you and best = regards,

Adrien

= --Apple-Mail=_B48CFC15-E907-45E7-9A57-8D834FDC38D4--