timestampsinglestorecrate

How to store timestamp in memsql?


I want to export data from a crate database to memsql. The crate database stores its timestamps in milliseconds based on UTC.

Yet when importing this as such to a memsql database, my values get zeroed out.

How should I import my timetamps in memsql?


Solution

  • You can insert them as strings in the format:

    YYYY-MM-DD HH:mm:ss
    

    Hence, a timestampInMs of 1489582041572 should become: 2017-03-15 12:47:21


    In typescript, I created a conversion script for it with the help of moment.js via:

    const convertTimestamp = (timestampInMs: number): string => {
        return moment.utc(timestampInMs).format("YYYY-MM-DD HH:mm:ss");
    };