Created
June 10, 2017 07:57
-
-
Save momin-riyadh/16645b676946c6a45e4018f5c7f1bcc0 to your computer and use it in GitHub Desktop.
JavaScript DateTime Function
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
| // DATE | |
| var d1 = new Date(); | |
| console.log(d1.toTimeString()); | |
| var d2 = new Date(); | |
| console.log(d2.toDateString()); | |
| var d3 = new Date(2324344442424); | |
| console.log(d3.toString()); | |
| var d4 = new Date("March 25 2018"); | |
| d4.setYear("2020"); | |
| console.log(d4.toString()); | |
| var startTime = new Date(); | |
| timeCount(); | |
| var endTime = new Date(); | |
| var elapsed = endTime.getTime() - startTime.getTime(); | |
| console.log(elapsed); | |
| function timeCount() { | |
| for (var i = 0; i < 1000000000000; i++) { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment