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,620
Reaction score
1,154
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,091
Reaction score
1,573
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,091
Reaction score
1,573
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

Was real busy today but I found a few minutes to start on the named cultists and how to give each of them visually distinctive morphology within the confined of the cult robes. I really dislike straight recolors so I trying real hard with the small details on these.
Here's a BlueSkies 3 Announcement Trailer up! :yhappy: Hope you all enjoy! ^^ <3

Art Twitter is nice, Im so used to that platform being....A literal maw of despair.
ezgif.com-video-to-gif.gif
with the apartment done, I've finished work on the first area and begun the tutorial. Have a sneak peak at the Biting Boroughs.

Forum statistics

Threads
134,834
Messages
1,251,045
Members
177,629
Latest member
tttttt
Top