How do I get the time in seconds

0 favourites
  • 3 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello, i am trying to create a "System" in my game that captures the player idle time (time away), i already tried to use "Time Away L" plugin (using Time Away L it works really fine on the preview, but when the game its exported (android), it doesnt work). So i am trying something different, get the current date in seconds and do the calculation to get the "Idle Time", does anyone have any idea how i do this?

  • Browser.ExecJS("Date.now()") will give you the system's Unix time in ms.

    To get seconds, divide by 1000 and round. You should save this value to local storage every x seconds, and compare the current Unix time with the saved time upon resuming the game.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Browser.ExecJS("Date.now()") will give you the system's Unix time in ms.

    To get seconds, divide by 1000 and round. You should save this value to local storage every x seconds, and compare the current Unix time with the saved time upon resuming the game.

    Thanks

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