How do I delete time zone using Browser.ExecJS("Date()")

0 favourites
  • 5 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • https://ibb.co/mx7ALH

    When I sue Browser.ExecJS("Date()") I get the time the date and the time zone, is there a way to prevent the time zone from displaying ?

  • Perhaps someone could teach me an easier way to go about this but I’d write a simple js file that gives you the specific part of the date you are looking for and run it with Valera Popov’s JS plugin. I’m very new to this kind of stuff, so there may be a way to do this with the browser object but I haven’t found it. I’m not sure whether you’re new to js like I am or not but if it is at all helpful, here is a link explaining how to get the current year in js (as an example). https://stackoverflow.com/questions/600 ... javascript

  • ultrafop thank you so much for your suggestion I'm learning js so I'm new, and the link you suggested is very helpful, but i'm thinking it could be a simple solution,

    there is a plugin by Rex but i'm trying to limit plugins as possible

    also found this from (@ultrafop thank you so much for your suggestion I'm learning js so I'm new, and the link you suggested is very helpful, but i'm thinking it could be a simple solution,

    there is a plugin by Rex but i'm trying to limit plugins as possible

    also found this from https://www.scirra.com/tutorials/940/how-to-easily-capture-date-and-time-and-insert-them-in-a-project :

    Browser.ExecJS("var currentdate = new Date(); currentdate.getFullYear() & '-' & (currentdate.getMonth() 1) & '-' & currentdate.getDate() & ' ' & currentdate.getHours() & ':' & currentdate.getMinutes() & ':' & currentdate.getSeconds();")

    but didn't work, maybe there some syntax error ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yo! Valera's plugin has an MIT license so you can use it so long as he's credited.You can't set new variables in the browser object (If I'm wrong, can someone show me how?), so you'll have a tough time with code like that. If the only issue is the time info at the end of your date you could also just make the textbox a size that cuts that part off.

  • thx again for the suggestion and i think I'm going to go with limiting the size of the textbox, the only issue with that is because the number of characters is not set ( variable and depend on each date ) I might end up with an extra character that doesn't make sense at the end :p but yeah...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)