JavaScript Date

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • new Date();
  • new Date(value);
  • new Date(dateAsString);
  • new Date(year, month[, day[, hour[, minute[, second[, millisecond]]]]]);

Parameters

ParameterDetails
valueThe number of milliseconds since 1 January 1970 00:00:00.000 UTC (Unix epoch)
dateAsStringA date formatted as a string (see examples for more information)
yearThe year value of the date. Note that month must also be provided, or the value will be interpreted as a number of milliseconds. Also note that values between 0 and 99 have special meaning. See the examples.
monthThe month, in the range 0-11. Note that using values outside the specified range for this and the following parameters will not result in an error, but rather cause the resulting date to "roll over" to the next value. See the examples.
dayOptional: The date, in the range 1-31.
hourOptional: The hour, in the range 0-23.
minuteOptional: The minute, in the range 0-59.
secondOptional: The second, in the range 0-59.
millisecondOptional: The millisecond, in the range 0-999.


Got any JavaScript Question?