const date = new Date()date.toLocaleTimeString() // 6:01:56 PMdate.toLocaleTimeString('zh-CN') // 下午6:01:56"// use default locale with options// only 'UTC' is guranteed to work across browser,// other IANA time zones (e.g. America/New_York) does not work in IE, Safari, Firebox Android, etc.date.toLocaleTimeString(undefined, {timeZone: 'UTC'}) // 10:01:56 AMdate.toLocaleTimeString('en-US', {timeStyle: 'full'}) // 6:01:56 PM Malaysia Timedate.toLocaleTimeString('en-US', {timeStyle: 'long'}) // 6:01:56 PM GMT+8date.toLocaleTimeString('en-US', {timeStyle: 'medium'}) // 6:01:56 PMdate.toLocaleTimeString('en-US', {timeStyle: 'short'}) // 6:01 PMdate.toLocaleTimeString('en-US', {timeStyle: 'short', hour12: false}) // 18:01date.toLocaleTimeString('en-US', {hour: 'numeric'}) // 6 PMdate.toLocaleTimeString('en-US', {hour: '2-digit'}) // 06 PM
References: