RE: Rest API date+time + sorting

  1. When querying the lastModifiedDate or createdDate from the Rest API, how do you get the time part – it just seems to return the date.  And how do you get it to show up in ISO8601 format?

For example


    “q”:”SELECT Id, lastModifiedDate from Item”
returns records like
why is the lastmodifieddate not in a date/time format?
2) When trying to sort by lastModifiedDate, an error comes (but without the order by clause it works…or using some other fields in order by it works).
    “q”:”SELECT Id, lastModifiedDate from Item order by LastModifiedDate asc”
{“type”:”″,”title”:”Internal Server Error”,”status”:500,”o:errorDetails”:[{“detail”:”An unexpected error occurred. Error ID: kg79hg1f15gm0xxrqjikt”,”o:errorCode”:”UNEXPECTED_ERROR”}]}
rshariff Rookie Asked on October 12, 2020 in SuiteTalk.
Add Comment
2 Answers
It worked for me, you just need to change the to_char(..) as some other term. I set to datemodified instead of lastModifiedDate and it worked:

"q": "SELECT id, lastName, firstName, email, to_char(lastModifiedDate, 'yyyy-mm-dd HH24:MI:SS') as datemodified FROM employee ORDER BY to_char(lastModifiedDate, 'yyyy-mm-dd HH24:MI:SS') DESC"

Rookie Answered on October 29, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.