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’t tried that) but 
passing dates before 1970 should be fine. Some related tickets for reference. 
https://datastax-oss.atlassian.net/browse/JAVA-264 
<https://datastax-oss.atlassian.net/browse/JAVA-264>
https://datastax-oss.atlassian.net/browse/JAVA-313 
<https://datastax-oss.atlassian.net/browse/JAVA-313>

Thanks
Alok Dwivedi
Senior Consultant 
https://www.instaclustr.com/




> On 12 Apr 2019, at 07:25, adrien ruffie <adriennolar...@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

Reply via email to