Show date from Unix timestamp field

I have created a screen to manage and study values from the users and I would like to show the field that is stored as a Unix timestamp but to be display as a regular date.

How could I do this?

You need to write a value transformer script which transform unix time to date format you prefer.

Here’s article about this:

Youll find more from google ”unix time to date javascript”

Thank you. I have gone into the script section and try to create the script by myself but I believe there are a couple of details I need to change to make it work:

const unixTimestamp = this.props.appActions.getDataSheet(‘allScores’)
const milliseconds = unixTimestamp * 1000
const dateObject = new Date(milliseconds)
const humanDateFormat = dateObject.toLocaleString()
return input;

In the first line I try to create the constant with the value of the Timestamp in my database, which is the field “date” in the dataSheet “allScores”. Using the snippets I wrote that accessing the dataSheet “allScores” but I believe it would be necessary to specify the field “date” which is the one that contains the Timestamp.

In the last line, I believe I would need to link somehow the “input” to the constant humanDateFormat. I don’t know if it would be just “input = humanDateFormat” before the “return input”.


This is how I’d do it in a list.

If you somehow need to fetch the Data sheet manually in the script then you need to find the correct data sheet row and then refer to “field”. E.g. like this:


1 Like

It is working now. Thank you!

One question. The script works perfectly but it shows two hours less than my timezone. How could I modify it to show exactly my timezone? (I am in Spain).

let ts = new Date(input);

let spainTime = ts.toLocaleString(“en-US”, {timeZone: “Spain/Madrid”});

1 Like

Thank you so much for your answer. It gave me a timeZone error but I wrote “Europe/Madrid” instead of “Spain/Madrid” and it worked. Thank you!