Created
June 5, 2015 11:10
-
-
Save Willmo36/265b4f6c40a60ce0e529 to your computer and use it in GitHub Desktop.
Friendly datetime method for JavaScript dates
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.prototype.toFriendlyDateTime = function() { | |
var friendlyTime = this.toLocaleTimeString(); | |
friendlyTime = friendlyTime.substring(friendlyTime.lastIndexOf(":"), 0); | |
return friendlyTime + " " + this.toLocaleDateString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment