How to convert date string back to unix time with GREL (OpenRefine) - date

I'm working with a large CSV file with millions of rows. I'm using OpenRefine to manipulate this large data set.
I have a column with date strings in this format "2017-08-17 04:36:00". And I would like to convert them to Unix time in integer format like 1502944560.
I see many Q&A on converting Unix time to Date String but not the other way around. Is this possible in OpenRefine?

value.toDate().datePart("time")
(see the bottom of this documentation for other conversion strings)

Related

Conversion of DateTime to Timestamp -adding the timestamp

I want to convert the date from former to later format
2020-04-14T14:56:43
TO
2020-04-14 14:56:43 UTC
Basically how to convert the DATETIME into TIMESTAMP IN Dataprep?
Why would you want to use TIMESTAMP instead of a DATETIME?
because it's smaller in size? (4 bytes vs 8 bytes)
Are you using MYSQL? I understand that there it's converted to UTC on write, and then converted back to the server's timezone on retrieval. (which isn't happening for DATETIME)
Or in general, working with timezones?
anyway, you can just remove the T in the middle between the date and the time by brushing over it, and replacing it with an empty space.
And if you desire to add a timezone (which would be.. +00), you can do that aswell. Trifacta will recognize that as a valid date type.
IF it's a unix-timestamp you're interested in - you can do that aswell with the function "unixtime()".
you can see all the tokens with which to construct and change your datetype here:
https://docs.trifacta.com/display/SS/Datetime+Data+Type
also, the community-website has a lot of dateformats-related questions.
https://community.trifacta.com/s/

SQLite Convert to SQLite Datetime Format from ANY datetime format

Coming out of an Oracle background converting dates from any format to any format is really easy.
How is this done in SQLite? I've searched and searched for answers and most of the answers simply say... Save your date/strings in SQLite in one single format which is YYYY-MM-DD HH:MM:SS.SSS. This seems rigid to me.
I don't have that luxury as my data is stored in this format DD/MM/YYYY HH:MI:SS am ex. 3/7/2020 8:02:31 AM.
NOTE: For single days/months my date values do not contain leading zeros and my time is NOT in military time.
How do I tell SQLite what my date format is so that I can correctly convert my stored dates to SQLite datetime formats?
Convert from SQLite Date Format to Oracle Date Example:
In Oracle I would simply use the to_date function like so
to_date('2019-03-07 15:39:34', 'YYYY-MM-DD HH24:MI:SS')
All one needs to do is to tell the function what the date format is... and then it spits out a date.... easy peasy. What this example does is convert a SQLite date formated string to a date that Oracle recognizes as a date. It doesn't matter what the format is in as I tell the function what format to expect.
How do I Convert Dates in SQLite from any format to the SQLite Format?
Converting from SQLite's date format string to ANY date is easy as there are functions built in that do this easily... but how to do this the other way round?

Import text file with ISO 8601 date/time values (2014-07-02T16:09:49-07:00)

When importing a text file into Access 2007 with date/time values like
2014-07-02T16:09:49-07:00
Access is unable to convert to date and shows the same as text. How do I convert the same in to date/time in Access?
You will probably need to import the ISO 8601 date/time values into a Text field, then use an Update query to convert those string values and write them to a Date/Time field. The question
Parsing an ISO8601 date/time (including TimeZone) in Excel
has several answers that include VBA functions you might be able to adapt depending on your specific requirements (and possibly some slight differences in date handling between Excel and Access).

Format of date / time values in database tables

I am reading a csv file with date fields of formatted mm/dd/yyyy. I expected the same kind of format from a Postgres table after the import, but I see yyyy-mm-dd hh:mm:ss.
The date fields in my table are defined as timestamp without time zone data type.
How do I maintain the same format of data? I am using PostgreSQL 9.3.
Postgresql only stores the value, it doesn't store formatting (which would waste space).
You can use the to_char function in your query if you like to get the output formatted in a special way. Details are in the manual.

Formatting date like medium date SQLite

How to format date in SQLite to get like 10-Jan-2014. What formatting string I need.
I have seen this SQLite date formatting and other questions but did not find my answer.
The given link formats the date to only numeric like 2014-01-10 etc.
Any one know?
Month names are not supported in SQLite.
You can use a lookup table to make and get your desired format with month names directly from query.
You can also write your own formatting function in your programming language.