Skip to main content
Solved

Get Creation Date


  • New Participant
  • 3 replies

I want to get the creation date of my records and I can't figure out what the variable is.

Is there way I can get it, like I can get the record ID (record.getId()). I have tried record.getDate(), record.createdDate()). 

Here is what I have:

return new Promise((resolve, reject) => {

base('Resource').select({
sort: [
{ field: 'Type', direction: 'asc' }
],
filterByFormula: 'AND({Type} = "'+type+'")'
}).eachPage(function page(records, fetchNextPage) {

records.forEach(function(record) {
console.log(record.getId());
console.log(record.getDate());
});
fetchNextPage();
}, function done(err) {
if (err) {
reject("Promise Rejected");
} else {
resolve(tldList);
}

});

});

Best answer by kuovonne

Thanks for the screen shot. Since you can see the createdTime in the object, have you tried getting the value directly, without using a function (record._rawJson.createdTime)? 

View original
Did this topic help you find an answer to your question?

4 replies

kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5995 replies
  • October 19, 2023

The library you are using might have been written before Airtable added createdTime of records to its API.

 

Create a “Created” field that shows when the record was created and then use that.

Or use a different library that has support for created time.

Or don’t use a library at all and make your own API calls directly. Then you can refer to the API documentation directly for how to get the createdTime.


  • Author
  • New Participant
  • 3 replies
  • October 19, 2023
kuovonne wrote:

The library you are using might have been written before Airtable added createdTime of records to its API.

 

Create a “Created” field that shows when the record was created and then use that.

Or use a different library that has support for created time.

Or don’t use a library at all and make your own API calls directly. Then you can refer to the API documentation directly for how to get the createdTime.


I'm using the airtable.js library (https://github.com/Airtable/airtable.js). What library supports created time? I can see the created time when console logging but it's part of _rawJson. So I'm a bit confused on why I can't get created time. 


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5995 replies
  • Answer
  • October 19, 2023

Thanks for the screen shot. Since you can see the createdTime in the object, have you tried getting the value directly, without using a function (record._rawJson.createdTime)? 


  • Author
  • New Participant
  • 3 replies
  • October 19, 2023

That seems to work! Thank you


Reply