Showing "time ago" by fetching uploaded date/time

Hello koders, i see an amazing thread on Stack overflow where they discuss about showing time ago. im wondering if someone have the idea to implement this on our apps made with kodular.

here is the thread datetime - How to convert time to " time ago " in android - Stack Overflow

the thing is that, when someone post something on my app i also store the current date/time when they post. and shows it as like "5 minutes ago, 1 hour ago, 1 day ago, etc by comparing with the current time/date.

im also trying to do this, if worked i’ll post the solution here :slight_smile:

1 Like

i think that was possible to do with time tools and date tools extension, like we can compare difference between time posted and time now , i have tried date tools extension to compare date today and date expiry and that works good show me days left ,

2 Likes

thanks for the awesome tips, i’ll definitely try and see if works.

yes, this extension have that option to find difference between two times,

1 Like

and i have did that without that extension too, by converting time instant to millis and then use math components to - that values , like time posted(converted to millis) - time now(converted to millis)

1 Like

any example .aia ? how does it shows?

i dont have any aia example now, but i will try to make that, meanwhile you can use time tools extension which is also doing that work perfectly

2 Likes

got it. im working on different for now but i’ll surely try it

1 Like

Why do you need an extension to do a simple math subtraction?
You only need to know the milliseconds of the instant the post was posted and the milliseconds of the current instant. Subtract the first from the second and there! You have how much time passed in milliseconds. Then check if that number is greater than 86400000, then it means days, if not divide it by 3600000 for hours, if not use 60000 for minutes, etc.
Then format it any way you want.

5 Likes

Time to restart my work on Kodular Utility Blocks

Hopefully, by today, I will add a procedure block.

3 Likes
10 Likes

Thanks to everyone who contributed on this thread. i really appreciate it. also a big thanks to @pavi2410 for providing example. i hope many people will find it helpful.

2 Likes

Bro i didn’t understand in some block.where you find epoch block & how can i do that with all list time & date.i think i can understanding you.sorry for poor english.

epoch is a input of procedure

image

can be used for

procedures_callreturn

3 Likes

Tnx a lot.how can do that procedure with airtable list

It is used like this

2 Likes

for me its showing 49 years ago for each time picked,

blocks - 2019-12-09T100458.165

1 Like

What is the date you provided as input?

opps, i was using time picker to select time, its only giving time instant, i think its happening because of no date in this instant.

you can use like this,

blocks - 2019-12-09T101332.450

but for store time in airtable you have to store time of post with,

component_method (10)

2 Likes