Retrieve Date from Date/Time Field in SharePoint List with Javascript?
-
08-02-2021 - |
Question
I am trying to pick up the date for each item in a list but I cannot seem to figure out all to get the value.
I am using:
var startDate = listEnumerator.get_current().get_item('Start_x0020_Date')
Solution
In your success function, you can try something like below:
function Success() {
var listEnumerator = collList.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
var startDate = oList.get_item('DateTimeColumnName'); // 'DateTimeColumnName' is internal name of date field
}
}
You can find the complete code to get the list items using JSOM in below article:
How to: Retrieve Lists Using JavaScript.
How to find internal name of field:
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange