My list is showing "24 November, 2017 (without TimeStamp)"

The code on my index page is showing date in Numerals (11/24/17 and with TimeStamp) e.g. 2017-11-24 01:00:00

1) How do i remove the TimeStamp? 2) How do I change it to showing '24 November' instead of numerals?

var query = "<Query>
<OrderBy><FieldRef Name='Date' Ascending='False' /></OrderBy>

Full code:

<SCRIPT type=text/javascript> get() ;
function get() { var method = "GetListItems";                
var webURL =  $().SPServices.SPGetCurrentSite() ;                    
var list = "MyLibraries";                     
var fieldsToRead = "<ViewFields>"+"<FieldRef Name='Name' />" +"</ViewFields>";
var query = "<Query><OrderBy><FieldRef Name='Date' Ascending='False' /></OrderBy></Query>";           

({ operation: method, async: false, webURL: webURL, listName: list,
CAMLViewFields: "<ViewFields Properties='True' />",
CAMLQuery: query, completefunc: function (xData, Status)
{ $(xData.responseXML).SPFilterNode("z:row").each(function()
var date  =  $(this).attr("ows_Date");

$("#myDataTable").append("<tr align='middle'>" +
"<td align='left'>" +date+ "'></td>" + "</tr>");

}); } }); };

1 Answer 1


SharePoint date time fields always contains date and time, the time portion is just set to 00:00 and hidden from UI if the field is set to date only.

One way to properly format your dates:

Use a more modern API such as the REST API, which returns the date time as UTC ("YYYY-MM-DDTHH:MM:SSZ", e.g. "1994-11-05T13:15:30Z" ). Then use JavaScript's built in date to adjust the time zone and format the string into an appropriate format, e.g. Date.toLocaleDateString:

var date = new Date(utcTimeStringFromSharePoint);
var formattedDateString = date.toLocaleDateString();



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.