javascriptp5.jssystemtime

How to get system time?


I want to get the current year, month, day, hour, minute second, and millisecond in javascript.

I am also using p5.js, if that has any helper methods.

This is what I want:

Year=2018

Month=4

Day=20

Hour=10

Minute=15

Second=25

Millisecond=236

Solution

  • Questions like this are best answered by reading through the P5.js reference.

    Specifically, look at the Time and Date section, which lists exactly the functions you're looking for.