Last active
November 8, 2022 09:50
-
-
Save cp-sumi-k/5b65188b935ef97cdbf407532d2ced96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hours of date in 12 hours format (ha) : 5 pm | |
console.log(cDate.toLocaleString("default", { hour: "numeric", hour12: true })) | |
// MMM : Nov | |
console.log(cDate.toLocaleString('default', { month: 'short' }) | |
// MMM YY : Nov 22 | |
console.log(cDate.toLocaleString('default', { month: 'short', year: '2-digit' }) | |
// DD MMM YY : 07 Nov 22 | |
console.log(cDate.toLocaleString('default', { day:'2-digit', month: 'short', year: '2-digit' }) | |
// YYYY-MM-DDT00:00 : 2022-11-07T00:00 | |
console.log(cDate.toISOString().split("T")[0] + "T00:00") | |
// MMM DD, YYYY : Nov 07, 2022 | |
console.log(cDate.toLocaleString('en-US', { day:'2-digit', month: 'short', year: 'numeric' })) | |
// 07 November 2022 | |
console.log(cDate.toLocaleString('default', { day:'2-digit', month: 'long', year: 'numeric' })) | |
// dd/MM/yyyy h:mm a : 07/11/2022, 5:32 pm | |
console.log(cDate.toLocaleString('default', { day:'2-digit', month: '2-digit', year: 'numeric' , hour: "numeric", minute: "numeric", hour12: true})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment