In My sharepoint list i have a Duedate if type DateTime.Using Client object model when we fetch the value from this Field, it is displayed in the below format(Mon Jun 23 GMT+0530 2014).How to convert this in to MM/DD/yyy format?
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getListItem, "sp.js");
function getListItem()
{
var itemId = getUrlVars()["ID"];
//alert(itemId);
var clientContext= SP.ClientContext.get_current();
var pList = clientContext.get_web().get_lists().getByTitle('Customer');
pListItem = pList.getItemById(itemId);
clientContext.load(pListItem, 'Title', 'DueDate');
clientContext.executeQueryAsync(Function.createDelegate(this, this.ExecuteOnSuccess), Function.createDelegate(this, this.myFailFunction));
}
function ExecuteOnSuccess(sender, args)
{
ListDuedate=pListItem.get_item('DueDate');
alert(ListDuedate);
}
function myFailFunction() {
// do something to alert the user as to the error here.
alert('fail');
}
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
</script>
Thanks, Sandy