Which method returns the date as a human-readable string?
Analysis & Theory
`toString()` returns the full string representation of the date and time.
Which method returns only the date part in a readable format?
Analysis & Theory
`toDateString()` returns the date portion as a string like 'Mon Jul 01 2025'.
Which method returns only the time part as a string?
Analysis & Theory
`toTimeString()` returns only the time part of a Date object (e.g., '15:30:00 GMT+0530').
Which method converts the date to a locale-specific string?
D
date.toString('locale')
Analysis & Theory
`toLocaleString()` formats the date and time based on the user's locale settings.
What does `toISOString()` return?
B
A locale-specific format
C
An ISO 8601 formatted date string
Analysis & Theory
`toISOString()` returns a date string like `2025-07-01T12:00:00.000Z` (in UTC).
Which of the following formats the date as `MM/DD/YYYY`?
B
toLocaleDateString('en-US')
Analysis & Theory
`toLocaleDateString('en-US')` returns a string like `07/01/2025`.
Which method gives both date and time in local format?
Analysis & Theory
`toLocaleString()` returns both date and time based on local settings.
What will `new Date().toUTCString()` return?
C
Date in UTC format as a string
Analysis & Theory
`toUTCString()` returns the date as a string using UTC time zone.
Which format is used by default when you use `new Date().toString()`?
Analysis & Theory
`toString()` returns the full local time string including time zone.
How can you format a date to show only the year?
B
toLocaleString({ year: 'numeric' })
C
toLocaleDateString(undefined, { year: 'numeric' })
Analysis & Theory
`toLocaleDateString(undefined, { year: 'numeric' })` formats the date to show only the year.