Created
December 19, 2012 01:18
-
-
Save chrislawlor/4333624 to your computer and use it in GitHub Desktop.
No more looking this up every time I need to post Date / Time data to a Django-powered API
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
Date.prototype.toDjangoString = function() { | |
// YYYY-MM-DD HH:MM:SS | |
return this.getFullYear() + '-' + | |
(this.getMonth() + 1) + "-" + | |
this.getDate() + " " + | |
this.getHours() + ":" + | |
this.getMinutes() + ":" + | |
this.getSeconds(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment