Convert Unix Timestamp

Hello,

i request some Infos with api´s using get and there is a Timstamp included 1628435956.

How can i Convert this into a normal time, i need only minutes.

Thanks and greez

You can use the clock sensor.

image

The milliseconds you gave are for
Mon 19 January 1970 21:20:35
So the result is 20.

Only minute

minutos_2

1 Like

I think the Epoch Unix Timestamp counts the seconds since 1.1.1970.

2 Likes

Right @Anke

1628435956 are seconds. 1628435956000 are milliseconds.

grafik

1 Like

Hi,

Yes the timestamp is in the requested API (https://mempool.space/api/blocks) which I should be doing, this thing actually works.

To clear why im doing this.

Look here for my build:

i want the XX Minutes ago implemented, like here
image

i tried some as you tell but i get always 20

any kind of idea what i can do?

Do you want this?


This gives
19
18
16
55
49
33
25
11
10
7
as result

Change mediantime to timestamp if that is the time you want.

this wont work on my build.

for example:

i want listed the blocks with XX Minutes ago

i have only this api with this timestamps for this event.

Why wouldn't it work?

What does that mean. Isn't that what i showed you?

Do you want it look like
10 minutes
25 minutes
32 minutes
55 minutes
...

So, for me work this now. But i have the normal time like 22:02:17
but i need the minutes ago from the current time ^^

image

Idk i get this error:

Read this (especially point 2 and 3):

1 Like

Actually, i need the unix format epoch timestamp in seconds, how can i get it in App Inventor? Thanks.

You should check Clock blocks.

https://www.google.com/search?q=convert+unix+timestamp+to+minutes&rlz=1C1CHBF_enUS887US887&oq=convert+unix+timestamp+to+minutes&aqs=chrome..69i57.9078j0j7&sourceid=chrome&ie=UTF-8 . Convert to minutes and then divide minutes by 60.

A Unix Epoch is already in seconds; Epoch, also known as Unix timestamps, is the number of seconds (not milliseconds!) that have elapsed since January 1, 1970 at 00:00:00 GMT (1970-01-01 00:00:00 GMT).

1 Like

but how do you get it, no such function there?

Have you tried dividing the (clock.now as milliseconds) by 1000 ? (to get seconds)

1 Like

is it that simple :laughing: ? tried, clock.now cannot be divided by 1000. tried format it using pattern"S", not sure that's the right way.

convert instant to millis then divide by 1000