EVL – ETL Tool


Products, services and company names referenced in this document may be either trademarks or registered trademarks of their respective owners.

Copyright © 2017–2022 EVL Tool, s.r.o.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.

Table of Contents

guess-timestamp-format

(since EVL 2.4)

Read line by line standard input or an input <file> and try to guess format string of the date, datetime or timestamp.

It uses the <config_file> with the list of format strings like:

%Y-%m-%d %H:%M:%S
%Y-%m-%dT%H:%M:%S
%Y-%m-%d
%d/%m/%y %H:%M
%-m/%-d/%y %H:%M
%d.%m.%y %H:%M
%d.%m.%y %-H:%M
%d.%m.%y %-H:%M:%S

Unless ‘--config’ option is used, it uses a file timestamp-formats-order.csv from the same folder as this script (try ‘which guess-timestamp-format’).

Synopsis

guess-timestamp-format
  [-i|--input=<file>] [-c|--config=<config_file>] [-d|--with-data-type]
  [-v|--verbose]

guess-timestamp-format
  ( --help | --usage | --version )

Options

-c, –config=<config_file>

-d, –with-data-type

-i, –input=<file>

-v, --verbose

print to STDERR info/debug messages

--help

print this help and exit

--usage

print short usage information and exit

--version

print version and exit

Examples

  1. Let us have this file ‘timestamps.csv’:
    03/12/2022 11:20:00
    03/12/2022 01:02:00
    03/13/2022 03:24:55
    03/14/2022 11:20:59
    

    Following comman recognize the format:

    guess-timestamp-format < timestamps.csv
    

    and returns:

    %m/%d/%Y %H:%M:%S
    

    With the option ‘--with-data-type’ it returns full data type information:

    datetime("%m/%d/%Y %H:%M:%S")