Pentaho kettle value conversion - etl

I wanted to convert microseconds to data:
60000000 -> 1997-2-12 (something like this).
This means the new field contains year-month-day-hour-minute-seconds-microseconds
Thx.

microseconds (or any time span) can't be directly converted to a date, because you need a starting date and then add your timespan to that date, to end up with a calculated date. Quite often, timespans expressing dates are using the unix epoch start date of January 1st, 1970, 0:00 UTC as their base date.
To calculate your target date, you could use the Calculator step from Kettle. First reverse the sign of your microseconds timespan (multiply with -1), then use the calculation Date A - Date B (milliseconds) to calculate your new date.
as your new field is a Date field, you can format the output to your own specification.

Related

Convert epoch timestamp to normal timestamp in nifi

I want to convert the epoch timestamp to a normal timestamp.
i have tried ${field.value:format('MM/dd/yyyy HH:mm:ss.SSS')} in update attribute it give some wrong date in 1970 for the value 1625777940
if you have epoch timestamp in seconds then converting it to java is simply multiply by 1000 because java counts time in milliseconds since 1/1/1970 (the same base as unix).
so, this should work:
${field.value:multiply(1000):format('MM/dd/yyyy HH:mm:ss.SSS')}

What is the time format in chrome dev tools cache Expires/ Max-Age?

I noticed the time format in chrome cache expiry is in format of 2021-06-19T08:38:40.980Z.
I do not recognize this time format and cant find about its conversion to UTC. So, my question is what kind of time format is this one. And how to convert it to UTC?
That is the ISO 8601 extended date time format. It also conforms to the RFC 3339 timestamp format, and the ECMAScript date time string format. Basically, that's the standard, most preferred way to represent a timestamp (as a string) on the Internet.
The date part is in yyyy-MM-dd format (year, month, day).
The T stands for "Time" and separates the date part from the time part.
The time is in HH:mm:ss.fff format (hour of 24-hour clock, minute, seconds, fractional seconds - milliseconds in this case).
The Z stands for "Zulu", another name for UTC. It indicates that the date and time before it are represented in UTC.
Thus, you do not need to convert it. The value is already in UTC.

combining date and time and changing it to GMT

I have read many answers for combining date and time and nothing worked so far. I am working in Oracle SQL developer version 3.1.06 and I am trying to combine date and time stamps together. Date is in format dd-mmm-yy. And time is in the following 3 formats-
1. 0348A-- meaning 3:48 am
2. 03:48:00
3. 228 -- meaning minutes from midnight, calculated as (3*60)+48.
And for all these timestamps, I want a query that gets me to this format --
mm/dd/yyyy hh:mm:ss .
I can change the dates and times to string and attach them, but then when I work in powerpivot I am not able to change them to the required format. So, I want to do it in the query itself.
I have already tried something like this-
1. CAST(deptdt as DATETIME)+CAST(time as DATETIME)
2. CAST(depdt AS TIMESTAMP(0)) + (depdt - TIME '00:00:00' HOUR TO SECOND) AS DATETIME
Please help!!

Convert Unix Timestamp - Spotfire Analyst

I'm importing SQL data into Spotfire Analyst. All of the date and time fields are in the form of a Unix timestamp. What's the best way to convert this into an actual date format that I can manipulate in Spotfire?
Utilizing a calculated column you can calculate the datetime based on the UNIX epoch.
We simply add our seconds to the DateTime of the UNIX epoch (JAN 01 1970 00:00:00 UTC) to get the result. Below is an example of the UNIX time when I started writing this post.
DateAdd("second",1429733486,DateTime(1970,1,1,0,0,0,0))
The below is what should work for you:
DateAdd("second",[UNIX_TIMESTAMP_COLUMN],DateTime(1970,1,1,0,0,0,0))
Keep in mind these dates produced will be in the UTC timezone as per the JAN 1 1970 epoch. If you need them in your local time zone you may have to adjust accordingly with further DateAdd functions adding/subtracting time as per current conversions. Also, if you observe daylight savings time you may need to add some extra case logic to handle that as well.
Please let me know if you have any questions or need further clarification.
In 7.0 and later you can use
FromEpohTimeSeconds([UNIXDATE])
or
FromEpohTimeMilliseconds([UNIXDATE])

How do I format a datetime on sqlite with timezone?

for example I have this date jan 5, 2010 14:00 wednesday gmt-8
how do I implement this so I can save it with timezone?,
I can save this using nsformatter with yyyy-MM-dd hh:mm
and saves as
2010-01-05 14:00
but how about w/ timezone?
(it should be saved in datetime format.. not text format)
You can use [format setDateFormat:#"yyyy-MM-dd hh:mm a"] for timezone it will give output like this "2010-01-05 02:00 PM"
or
[format setDateFormat:#"MMM dd, yyyy hh:mm a"]
Put the timezone in another column and you won't break the limited existing date functionality of SQLLITE. Its really easy to add columns to sqllite with an alter table statement. Android SQLite Database, WHY drop table and recreate on upgrade
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:
TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar.
INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.
Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions.

Resources