Possible Duplicate:
Javascript date sorting by convert the string in to date format
I am not good in jquery so I was wondering if there is a way or plugin I can use to sort date divs. I have date in YYYY:MM:DD HH:MM:SS format. I am displaying date in divs as shown below. Divs are in unordered format and I want to sort them on latest date first basis.
<div id="dateDiv">2012-04-15 10:25:45</div>
<div id="dateDiv">2012-04-10 19:41:08</div>
<div id="dateDiv">2012-04-20 07:00:10</div>
<div id="dateDiv">2012-04-12 16:45:50</div>
Thanks
I don’t know much about plugins…although if you want a light weight method without plugins, you may try this:
html:
For js:
UPDATE:
Thanks to CMS for answering this question about parsing dates: Why does Date.parse give incorrect results?
Now, don’t tell me this doesn’t work…hehe