Open this example in the interactive library
Source code
console.log(new Date(Date.UTC(2026, 2, 0)).getUTCDate());
Sample output
28

Get the last day of a month. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
console.log(new Date(Date.UTC(2026, 2, 0)).getUTCDate());
28