Ask Your Question
1

How to convert unix timestamp to regular time stamp

asked 2020-01-27 15:46:52 -0500

anonymous user

Anonymous

updated 2020-01-28 08:42:29 -0500

metadaddy gravatar image

My input data is in Unix timestamp colm time(integer)=1574957793

I'm trying to use field converter convert_type to DateTime and what will be my date format to select?

Example : expected output field yyyy-mm-dd hh-mm-ss (timezone)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-01-28 08:38:12 -0500

metadaddy gravatar image

updated 2020-01-28 08:41:45 -0500

The issue here us that the Field Type Converter expects times to be in milliseconds, while your time is in seconds. You can use Expression Evaluator to do the conversion, with a Field Expression of

${time:extractStringFromDate(time:millisecondsToDateTime(record:value('/timestamp') * 1000), 'yyyy-MM-dd HH-mm-ss z')}

You may need to adjust the format string according to the SimpleDateFormat docs.

For example:

image description

Note - the expression above yields a string. If you need a datetime, you can just use

${time:millisecondsToDateTime(record:value('/timestamp') * 1000)}

Example:

image description

edit flag offensive delete link more

Comments

1

Thank you FYI. It's Helpfull.

strem_dev gravatar imagestrem_dev ( 2020-01-28 10:05:48 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-01-27 15:46:52 -0500

Seen: 304 times

Last updated: Jan 28