Last active
November 8, 2023 09:42
-
-
Save abcdeepakr/ef5bd8e5755d9d383967dee45d7537ef to your computer and use it in GitHub Desktop.
to local from unix
This file contains 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
export function parseUnixTimeStamp(unix_timestamp){ | |
var date = new Date(unix_timestamp); | |
// var hours = date.getHours(); | |
// var minutes = "0" + date.getMinutes(); | |
let parsedDate = date.toLocaleString([], {year: 'numeric', month: 'numeric', day: 'numeric',hour: '2-digit', minute:'2-digit'}) | |
// or | |
parsedDate = date.toLocaleString([], {year: 'numeric', month: 'short', day: 'short',hour: '2-digit', minute:'2-digit'}) | |
// or | |
parsedDate = date.toLocaleString([], {year: 'numeric', month: 'long', day: 'long',hour: '2-digit', minute:'2-digit'}) | |
return parsedDate // 08/02/2023, 08:18 | |
} | |
let date = new Date() | |
date.toLocaleString("en-IN",{ | |
weekday: "short", | |
year: "numeric", | |
month: "long", | |
day: "numeric", | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment