Seconds since 1970 to yyyy-mm-dd

Can anyone share a project or logic on how to convert Seconds since 1970 to a date format (yyyy-mm-dd)?

Thanks in advance!

2 Likes
3 Likes

Thanks!! I’ll check this out!

1 Like

Check this out
https://x.thunkable.com/projectPage/61cd0bd6237278001093b960
done in Thunkable blocks without any calls to external code.

Credit goes to @manyone

This is another version. all using blocks
https://x.thunkable.com/projectPage/617d60166771f90011dd10ea

3 Likes

oof :sweat_smile: . so many blocks to only get back year/month/date. I recently put in a feature request for date blocks. Hopefully sometime this year we can replace both of our solutions with Thunkable Blocks that do this transformation for us and into any format we want.

@muneer & @manyone thank you for sharing these solutions. I had no clue how to do these maths before! Very cool!

@maptheunknown IDK if i shared or made public the HTML files i use in that project. if not, i’ll put them up in my github account and link to it sometime this week!

2 Likes

Yes, I agree. When I was developing with AppGyver, it was much easier. The platform has a JavaScript block that you can pass any text as a JS function and you will get the result. Very easy and not very heavily loaded like the Web Viewer.

I really wish such a simple block will be available so that we get rid of the unnecessary heavy use of the Web Viewer and it can solve many other issues not only the data conversion.

In the other hand, to covert the seconds since 1970 you just need to multiply it by 1000 and pass it to a JS function that simple says

return new Date([Your parameter]).toString();
2 Likes

I was thinking that recently, too. I’d like to avoid the web viewer when just needing JavaScript. And example of this would be swipe detection without needing the canvas or keyboard entry detection without a text input component.

2 Likes

Would love :heart: this as a component event. It would’ve really made my most recent app submission the bees knees

Would really heart :heart: love this ^^^^^^

2 Likes

Thanks for all the responses! very helpful! I’ll try this out!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.