Converts a given Date object to a GMT date, removing any time information. This function sets the time to 00:00:00 UTC for the specified date, effectively stripping off the time part.
Date
00:00:00
The Date object to convert.
A new Date object representing the same day in GMT with the time set to 00:00:00.
// => Date representing '2024-01-01T00:00:00.000Z'toGMTDate(new Date('2024-01-01T00:00:00.000Z+08:00')) Copy
// => Date representing '2024-01-01T00:00:00.000Z'toGMTDate(new Date('2024-01-01T00:00:00.000Z+08:00'))
// => Date representing '2024-01-01T00:00:00.000Z'toGMTDate(new Date('2024-01-01T00:00:00.000Z-08:00')) Copy
// => Date representing '2024-01-01T00:00:00.000Z'toGMTDate(new Date('2024-01-01T00:00:00.000Z-08:00'))
Converts a given
Date
object to a GMT date, removing any time information. This function sets the time to00:00:00
UTC for the specified date, effectively stripping off the time part.