How do I convert Datetime on ETL Import?

65 views
Skip to first unread message

Joe S.

unread,
Sep 24, 2015, 4:32:57 PM9/24/15
to OrientDB
I'm trying to ETL import from a MySQL database. currently the information is in a string with mm/dd/yyyy hh:mm:ss tt format. ex. 8/22/2013 9:43:05 AM

I can't change the format in the database because I have another program writing the information to it, but I want to be able to move it into orientdb.

Tested this as a transform.

{ "field": { "fieldName": "time_modified", "expression": "date( $time_modified, 'mm-dd-yyyy hh:mm:ss tt' )" } }


How can I use the ETL import to convert it to the proper datetime format?

Alternatively I can leave it as a string, but then I don't think I can make calculations against it.

Jihoon Park

unread,
Sep 26, 2015, 1:34:12 PM9/26/15
to OrientDB
I'm also new to OrientDB, but I think you should try changing the global datetime format("yyyy-MM-dd HH:mm:ss a") first and then use asDateTime() in the ETL configuration file like this:
{ "field": { "fieldName": "your_new_field_name", "expression": "your_old_field_name.asDateTime()" } }

Joel Spriggs

unread,
Apr 15, 2016, 11:24:53 PM4/15/16
to OrientDB
I realize it's a probably a bit late for you to use it 7 months later, but I had basically the exact same scenario.  ETL process, where I had a timestamp field giving me dates as a string like this: 20141120012052UTC

I used this transform to fix it 

   { "field": 
    { "fieldName": "timestamp", 
      "expression": "timestamp.date(timestamp, 'yyyyMMddHHmmssz')"
    }
   },
Reply all
Reply to author
Forward
0 new messages