Created
February 1, 2012 16:08
-
-
Save stlsmiths/1717748 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
// | |
// Custom Parser for SQL formatted date strings ... | |
// | |
// Following taken directly from Satyam's YUIBlog article: | |
// http://yuiblog.com/blog/2008/10/15/datatable-260-part-one/ | |
// | |
// This is used in the formatter below, to first convert the data to a JS Date, then format it !!! | |
var parseSQLDate = function (o) { | |
var parts = o.split(' '); | |
datePart = parts[0].split('-'); | |
if (parts.length > 1) { | |
var timePart = parts[1].split(':'); | |
return new Date(datePart[0],datePart[1]-1,datePart[2],timePart[0],timePart[1],timePart[2]); | |
} else { | |
return new Date(datePart[0],datePart[1]-1,datePart[2]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment