# Is it possible to use javascript in app?

**URL:** <https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467>\
**Category:** Questions about Thunkable X\
**Created:** [September 23, 2022, 5:47pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467 "2022-09-23T17:47:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 23, 2022, 5:47pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/1 "2022-09-23T17:47:04Z")

</div>

hi

I thought of using javascript in the webviewer to run a script that gives a timestamp when given a date and time is this possible?  
Doesn’t this violate play store rules as I understand?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 23, 2022, 9:13pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/2 "2022-09-23T21:13:28Z")

</div>

I have lots of demo project that do just that.

[https://x.thunkable.com/projectPage/62065661baff3d00106f9ffb](https://x.thunkable.com/projectPage/62065661baff3d00106f9ffb)

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 24, 2022, 3:26am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/3 "2022-09-24T03:26:05Z")

</div>

hi

after looking at your project if I understand correctly we have to go through an api?

I try to use this one

[[https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11](https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11) 13:38:00]([https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11](https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=2019/02/11) 13:38:00)

but I get an error message in thunkable on my device with this blocks

 ![Capture d’écran 2022-09-24 à 05.34.30](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41f79646fea9c8ecb01c4105fcd31ba9cd97f42c.png)

update regarding the use of api i made simpler

 ![Capture d’écran 2022-09-24 à 08.00.18](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/9/699ac9c1af1a77e8f5937c589d9bde6b23d2300c.png)

the api is good but if javascript is authorized I would look for a tutorial that explains how to pass a value to a script in the webviewer

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 24, 2022, 3:37am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/4 "2022-09-24T03:37:01Z")

</div>

The Web Viewer URL is what links to the javascript file.

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 24, 2022, 3:47am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/5 "2022-09-24T03:47:10Z")

</div>

hi

what is not clear to me at first can you put on the Playstore an application that contains javascript?

(the muner example uses an api)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 24, 2022, 4:03am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/6 "2022-09-24T04:03:23Z")

</div>

Why would you not be allowed to do that? Isn’t code just code? Why would it matter what language it’s in? Is there a specific playstore policy that you’re reading and concerned about?

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 24, 2022, 4:11am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/7 "2022-09-24T04:11:46Z")

</div>

![Capture d’écran 2022-09-24 à 06.08.18](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/3/73636a4afc894e1ade5978328b69f5923c074f76.png)

i read that (I have trouble understanding my translator)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 24, 2022, 6:49am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/8 "2022-09-24T06:49:41Z")

</div>

The way I understand that is if your app uses Javascript, you still have to follow all play store policies.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [September 24, 2022, 9:18am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/9 "2022-09-24T09:18:06Z")

</div>

Of course you may run JavaScript in your app, after all, that’s what’s running under the hood in all reality. React native uses jsx and JavaScript under the hood to power the app built by Thunkable.

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 24, 2022, 9:28am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/10 "2022-09-24T09:28:13Z")

</div>

well here I am reassured it certainly faster than an api for what I want to do  
but for the moment I continue with the api

thanks

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 24, 2022, 9:30am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/11 "2022-09-24T09:30:11Z")

</div>

well here I am reassured it certainly faster than an api for what I want to do  
but for the moment I continue with the api

update

the api returns the timestamp as text I add zero to transform it into numeric and it does not work

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 24, 2022, 9:35am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/12 "2022-09-24T09:35:33Z")

</div>

I explain all about how to get dates using JavaScript in this post

> [@Date operations (No API)](https://community.thunkable.com/t/date-operations-no-api/1355407/3):
>
> I made a simple JavaScript code to get the date after certain number of days. [image] This is giving today’s date but if I add some days I get the future date in the label. [image] All managed by a web viewer extension running .html file added to the project as an asset… The Google sheet solution is still a viable solution and it works just as good. This is the blocks of the project This is the JavaScript Code \<!DOCTYPE html\> \<html\> \<head\> \<script src="https://thunkable.github.…

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 25, 2022, 5:43am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/13 "2022-09-25T05:43:42Z")

</div>

hi

[Opérations de date (pas d’API)](https://community.thunkable.com/t/date-operations-no-api/1355407)

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 25, 2022, 5:54am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/14 "2022-09-25T05:54:03Z")

</div>

hello

I wanted to experience what I read in this evocative post

# [Date operations (No API)](https://community.thunkable.com/t/date-operations-no-api/1355407)

given what I want to do  
I may be wrong but with this method we even “exit” the application to retrieve the script that interprets the post message and receives message blocks  
what is the advantage?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 25, 2022, 6:54am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/15 "2022-09-25T06:54:05Z")

</div>

> [@bibbi](#):
>
> this method we even “exit” the application to retrieve the script

No. You are running the **script** in a `web viewer` which is being controlled by the app itself. You are running a script by using an internal controlled access to the web that is why you cannot run something like **Google Login Page** because it requires access to the actual browser and does not allow the code to run from a **window** inside the app.

Hope it is clear now.

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 25, 2022, 8:21am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/16 "2022-09-25T08:21:30Z")

</div>

in fact I confuse the script and the library

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 25, 2022, 11:49am UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/17 "2022-09-25T11:49:25Z")

</div>

hi  
with the elements that I found in different of your posts, I finally get a timestamp from a date  
but I have a very small problem the timestamp obtained corresponds to my local time plus 2 hours how to correct this?  
i tried this but it does not work : var ego = (new Date(message).getTime()-7200000) / 1000 ;

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 25, 2022, 12:13pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/18 "2022-09-25T12:13:27Z")

</div>

> [@bibbi](#):
>
> var ego = (new Date(message).getTime()-7200000) / 1000 ;

getTime() will return GMT time. You need to use **.toTimeString()** or **.toLocaleTimeString()** to get the time in the user’s local time zone.

**[Update]**  
[https://x.thunkable.com/projectPage/621c9b6c73ba2500119d10ef](https://x.thunkable.com/projectPage/621c9b6c73ba2500119d10ef)

This project will help you test the different scripts because you can issue JavaScript code and get the response directly.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/c/6ce7a2ac46a053b0c3c6ba76ed29367e0a293a87.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/4/34dee8b18f14e72a3e4d1ec620fc7ea5d02d15d3.png)

---

<div class="post-metadata">

**Author:** ![bibbi](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@bibbi](https://community.thunkable.com/u/bibbi)\
**Post date:** [September 25, 2022, 5:31pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/19 "2022-09-25T17:31:19Z")

</div>

hi

thanks for your support  
I explained myself badly, no doubt, what I want to correct is the timestamp which is two hours ahead

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [September 25, 2022, 5:35pm UTC](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467/20 "2022-09-25T17:35:20Z")

</div>

> [@Fun Share: Fun with Date Formatting](https://community.thunkable.com/t/fun-share-fun-with-date-formatting/1681696):
>
> This project shows different ways of working with time/timestamps using the web viewer. Keep your time in seconds (as it really should be) and format it for the user only when needed! AND format in your preferred way! ON THE FLY! [https://x.thunkable.com/projectPage/61e8895b1943bc0010bf7b86](https://x.thunkable.com/projectPage/61e8895b1943bc0010bf7b86) It allows you to use any formatting string available here Skys the limit! The basic idea here is to pass “seconds since 1970” values and a format to the webviewer and to receive back a formatted version o…

Check out this convoluted project that shows you how to do exactly what you’re asking

[Next page](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467.md?page=2)
