Convert Unix Timestamp

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


like this?

I got it, using component_method
Thanks!

For any avoidance of doubt:

1 Like

This works

Hours 10 is the +10 GMT for me

Unix Timestamp can go directly in to "second" then add the offset 1970/1/1 and your Time Zone ( +10 for me)

One common confusion with Unix timestamps is whether they’re in seconds or milliseconds. A 10-digit epoch (e.g., 1711785600) is in seconds, while a 13-digit one (1711785600000) is in milliseconds. If your conversions seem way off, you might just need to divide or multiply by 1000!

Another thing to watch for is time zone offsets. Epoch time is always in UTC, but local time depends on your zone. For example:

  • EST (UTC-5:00) → Subtract 5h
  • PDT (UTC-7:00, DST) → Subtract 7h
  • IST (UTC+5:30) → Add 5h 30m

DST can also mess with conversions, so it's good to double-check. If you need a quick way to switch between seconds/milliseconds and apply time zone offsets, I built a simple epoch converter tool. Hope it helps!

1 Like