SamAmco / track-and-graph

An android app for tracking personal data and creating custom graphs
GNU General Public License v3.0
438 stars 40 forks source link

CSV error "Import failed: Could not interpret the timestamp for record on line: [3]" #160

Closed laghee closed 1 year ago

laghee commented 2 years ago

I switched over from another app I've been using & current tracking is working great, but I have 10 years of back data I need to import for this to be useful. I did a CSV export from the current state to see what the format needs to be. But though I thought I'd captured it perfectly, I keep hitting the above error.

I've tried with headers and without, with quotes around the timestamp values and without, and using simpler timestamps, but nothing seems to work. So I have a few questions:

SamAmco commented 2 years ago

Hi sorry for the late reply, I can't say exactly why your timestamp is failing. The code that parses that text is annotated like so:

     * Returns the ISO date formatter that prints/parses a date-time
     * with an offset, such as '2011-12-03T10:15:30+01:00'.
     * <p>
     * This returns an immutable formatter capable of printing and parsing
     * the ISO-8601 extended offset date-time format.
     * The format consists of:
     * <p><ul>
     * <li>The {@link #ISO_LOCAL_DATE_TIME}
     * <li>The {@link ZoneOffset#getId() offset ID}. If the offset has seconds then
     *  they will be handled even though this is not part of the ISO-8601 standard.
     *  Parsing is case insensitive.
     * </ul><p>
     */
    public static final DateTimeFormatter ISO_OFFSET_DATE_TIME;
    static {
        ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder()
            .parseCaseInsensitive()
            .append(ISO_LOCAL_DATE_TIME)
            .appendOffsetId()
            .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
    }

I recommend making sure your timestamp adheres to the ISO-8601 standard

SamAmco commented 1 year ago

Closing due to inactivity