Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82756

Format::dateTime with Unix timestamp

$
0
0

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?


Viewing all articles
Browse latest Browse all 82756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>