Last active
May 7, 2021 05:34
-
-
Save nishantrpai/a69cd8eb4f010e26b7b6be6ebf08b706 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
| // For time series data | |
| let d = new Date(); | |
| let ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d); | |
| let mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d); | |
| let da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d); | |
| let hh = new Intl.DateTimeFormat('en', { hour: 'numeric', hour12: false }).format(d); | |
| let mm = parseInt(new Intl.DateTimeFormat('en', { minute: 'numeric' }).format(d)); | |
| mm = mm > 9 ? mm : `0${mm}` | |
| let ss = parseInt(new Intl.DateTimeFormat('en', { second: 'numeric', hour12: false }).format(d)); | |
| ss = ss > 9 ? ss : `0${ss}` | |
| console.log(`${mo} ${da} ${ye} ${hh}:${mm}:${ss}`); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add an alias in bash
alias timenow='node ~/timenow.js | xsel -ib'Whenever you run
timenowin the terminal, it'll be copied automatically.