Created
July 12, 2022 20:23
-
-
Save ivandez/39b06478d5565225fd35ea90036a1436 to your computer and use it in GitHub Desktop.
function to convert Date into string formart TS
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
private formatDate = (date: Date): string => { | |
const formatedDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(); | |
const formatedTtime = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); | |
const dateTime = formatedDate + " " + formatedTtime; | |
return dateTime; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment