Unix timestamp into readable form

Hello!

I’ve looked around in the forums and haven’t found a solution for my issue. I’m pulling in an Unix timestamp via API and I need to display it in “human readable” form in my app. I found a few topics about timestamps, but nothing that I could use in my scenario. All the topics about changing the timestamp format into a readable one are related to timestamps generated by tulip itself, not from an outside source like in my case.
App in question is for warehouse work and timestamp is for arrival date of cargo.

Cheers!
Kristjan

hello @Kristjan, welcome to the Tulip Community!! it would be great if you could introduce yourself at Welcome to the Community, let's meet!!

regarding your question, the FORMAT_DATE_TZ() function will convert a Timestamp over to a human readable format for which you define the date components you display.

for example, here’s a formula I used: FORMAT_DATE_TZ(@App Info.Current Date and Time ,'DDMMMYY HH:mm','EST'):



here, without the FORMAT_DATE_TZ(), this is what the message looks like:

you can see more information on the available formatting here: Moment.js cheatsheet.

is this what you were hoping to achieve?? let us know!!

Hello Gio, thank you for the reply, but sadly this solution is not going to work for me. Since I’m not looking to show current time, then “app info.current date and time” is not going to help. I’m trying to pull in the date and time info from an external API and since the information is not in datetime or date format then the function FORMAT_DATE_TZ gives an error.

Is there a way to maybe convert that API variable into a different type of (date and time) variable and then using that to get data into a readable form? I’ve been looking for some solution like that as well, but haven’t found one yet.

Cheers!
Kristjan

ahh, my apologies @Kristjan as I didn’t fully read your title.

you could use a webpage to convert UNIX timestamps to human readable formats through a Connector Function. here’s an example of one I found: https://showcase.api.linx.twenty57.net/UnixTime/fromunix?timestamp=1549892280. as you can see, you can enter a UNIX timestamp in the URL which is then converted over to a human readable format.

in Tulip, you can create a Connector with a Function that returns this value for use in the app.

  1. create the Connector
  2. create the Function (the Response Body needs to be Text)
  3. run the Connector Function in your app. In your example, you can use the returned UNIX timestamp rather than the @App Info.Current Date and Time:

    result:

is this what you’re looking for?? let us know!!

Hey! Yes, this is exactly what I was looking for.

Thank you!
Kristjan

great to hear!! let us know if you have further questions.