I would be very glad if someone help me, I am trying to find REST analog of SP.Utilities.Utility.formatDateTime function:

var context = new SP.ClientContext.get_current();
var web = context.get_web();
var date = SP.Utilities.Utility.formatDateTime(context, web, new Date(), SP.Utilities.DateTimeFormat.DateTime);
context.executeQueryAsync(function() { console.log(date);});

Theoretically, according to this MSDN page it should be possible: https://msdn.microsoft.com/en-us/library/office/dn292556.aspx

However, I have yet to figure out what to send in as the first 2 parameters (context, web).

The request should look something like this: https://testsite.sharepoint.com/subsite/_api/SP.Utilities.Utility.formatDateTime(???,???,'2005-5-5',1)

if anyone can help crack this even more - would be greatly appreciated.

I hope this is at least a part of the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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