I have 3 timestamp field in my data. The first and third are set as read only in editor as I don't want the users to be able to edit those. The second is set as a date field.
I'm using the following code in order to format the date from 'U' to 'd-m-Y' but the JSON is showing null values returned.
Field::inst('Audits.Date_created')
->getFormatter(Format::dateTime('U', 'd-m-Y')),
Field::inst('Audits.Date_requested')
->getFormatter(Format::dateTime('U', 'd-m-Y'))
->setFormatter(Format::dateTime('d-m-Y', 'U')),
Field::inst('Audits.Date_completed')
->getFormatter(Format::dateTime('U', 'd-m-Y')),
Here is an excerpt from the JSON response.
{"data":[{
"DT_RowId":"row_3",
"Audits":{
"id":"3",
"Customer_id":"1",
"Location_id":"1",
"Date_created":null,
"Date_requested":null,
"Date_completed":null,
.........
Can anyone see what I am doing wrong?