p5.js | day() function
The day() function in p5.js is used to get the current day from the system’s clock. It returns the value inbetween 1 to 31.
Syntax:
day()
Parameters: The function does not accept any parameter.
Return Value: It returns an integer value which represents the current date.
Below program illustrates the day() function in p5.js:
Example: This example uses day() function to get the current day from the system’s clock.
function setup() { // Create Canvas of size 270*80 createCanvas(270, 80); } function draw() { // Set the background color background(220); // Initialize the parameter with day let d = day(); // Set the size of text textSize(16); // Set the text color fill(color('red')); // Display result text("Today's date is : " + d, 50, 30); } |
Output:

Reference: https://p5js.org/reference/#/p5/day
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- PHP | Ds\Set xor() Function
- PHP | pi( ) Function
- PHP | pow( ) Function
- PHP | each() Function
- D3.js | d3.max() function
- PHP | Ds\Map put() Function
- PHP | Ds\Map xor() Function
- D3.js | d3.min() function
- CSS | rgb() Function
- PHP | key() Function
- PHP | end() Function
- D3.js | d3.hsl() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



