The current time can be read with the second(), minute(), and hour() functions. This example uses map() to calculate the angle of the hands. It then uses transformations to set their position.
Clock: Revised by Caleb Foss. Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.
You can find the code history of these examples here: 2023 code, pre-2023 code. You can suggest improvements by contributing to the current website!
Related Examples

A small white circle on a grey background.
Linear Interpolation
Convert a number between 0 and 1 to another range.

A large yellow circle on a black background.
Map
Convert a number from one range to another range.

A small purple circle on a black background.
Random
Get random numbers.

A small white circle in a pink rectangle.
Constrain
Keep a number within a range.

A pink clock on a grey background.
Clock
Get the current time.