Is there anyway to pull the time and date from the players computer?

chrimp

Regular
Regular
Joined
Jul 29, 2020
Messages
69
Reaction score
19
First Language
English
Primarily Uses
RMMZ
Pretty self explanatory... I'm pretty certain there is a way to do this in javascript and I would prefer that
 

Soulrender

Jack Of All Trades
Regular
Joined
Jan 12, 2019
Messages
1,618
Reaction score
1,152
First Language
Polish
Primarily Uses
RMMV
Code:
const d = new Date();
d.getTime();

 

chrimp

Regular
Regular
Joined
Jul 29, 2020
Messages
69
Reaction score
19
First Language
English
Primarily Uses
RMMZ
Code:
const d = new Date();
d.getTime();

how would i set a variable to that?
 

Arthran

Regular
Regular
Joined
Jun 25, 2021
Messages
1,085
Reaction score
1,567
First Language
English
Primarily Uses
RMMZ
how would i set a variable to that?
Control Variables -> Script and then type this in the box:
JavaScript:
Date.now()

Note that both this method, and Soulrender's, will give you the number of milliseconds that have passed since January 1, 1970 00:00:00 UTC. This is sufficient if you're trying to determine how much time has passed between one point and another. For example, I can use Date.now() right now, and store the value. Then I can use it again later, and subtract the previous value from it, and then I'll know exactly how much time has passed since I used it previously.

But if you're trying to actually display the date/time in a human-readable format, then it would be done differently--depending on exactly what you're trying to do.
 
Last edited:

chrimp

Regular
Regular
Joined
Jul 29, 2020
Messages
69
Reaction score
19
First Language
English
Primarily Uses
RMMZ
Control Variables -> Script and then type this in the box:
JavaScript:
Date.now()

Note that both this method, and Soulrender's, will give you the number of milliseconds that have passed since January 1, 1970 00:00:00 UTC. This is sufficient if you're trying to determine how much time has passed between one point and another. For example, I can use Date.now() right now, and store the value. Then I can use it again later, and subtract the previous value from it, and then I'll know exactly how much time has passed since I used it previously.

But if you're trying to actually display the date/time in a human-readable format, then it would be done differently--depending on exactly what you're trying to do.
yeah, thats basically what i am doing. this is for a crop growth system so i need that subtraction method
 

Arthran

Regular
Regular
Joined
Jun 25, 2021
Messages
1,085
Reaction score
1,567
First Language
English
Primarily Uses
RMMZ
yeah, thats basically what i am doing. this is for a crop growth system so i need that subtraction method
Date.now() would definitely work for you then. Alternatively, you could use $gameSystem.playtime() . Use the former if you want the crops to continue to grow even when the game is closed. Use the latter if you want the crops to only grow while the game is running.
 

chrimp

Regular
Regular
Joined
Jul 29, 2020
Messages
69
Reaction score
19
First Language
English
Primarily Uses
RMMZ
yeah thanks for all the help, the variable thing worked
 
Last edited:

chrimp

Regular
Regular
Joined
Jul 29, 2020
Messages
69
Reaction score
19
First Language
English
Primarily Uses
RMMZ
[
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_9_22_2023_1_6_38.png
Working on a "dual tech" for two characters... it ends like the Raging Demon move from the Street Fighter games. The kanji sign here being "Lose". gotta tweak some things, but it looks pretty cool in game so far. love putting so many fighting game references in here since that and rpgs are my two favorite genres.
I've been thinking about making a tutorial on "how to draw digital art". I wonder how many are interested. It won't be anything fancy like color theory or anatomy. Just a technical on how to get things done such as how to use layer and other tools. To make it accessible, it is aimed at mouse users rather than pen tablet/display owners.
A new enemy approaches...

Ok, I finished updating my Bestiary Book. The only reason I can think of enemies having a second weakest to a spell is that the player might not have access to the more powerful version. Not that the spell is more powerful in itself but against certain enemies.
Leaf.gifFun New Guy.gifCoptemist.gifAyy.gif
Some new enemies for you all! We're picking up steam!

Forum statistics

Threads
134,703
Messages
1,249,922
Members
177,459
Latest member
felipesmoke94
Top