I have a date/time string like 2012-01-13 04:37:20 but I want to convert it to dd-mm-yyyy hh:mm, how can i do this?
I am using the following code but it throws an exception.
var now = "2012-01-13 04:37:20";
var dd = now.toLocaleDateString() + " " + now.toLocaleTimeString();
alert(dd);
You can do a simple string manipulation and create a
JavaScriptdate object. See function below, which accepts date in format://yyyy-mm-dd hh:mm:ssFiddle Demo here
The Script: