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

Sort on a numeric month value in a server side script and also use date field as format date.

$
0
0

My SSP has a date field which I need to not only sort ( either server side or front-end) but also format.
Not sure if I have to pull out the numeric month as a separate variable and sort that and use my HRDTNR fieldvfor the formatted date.

Here is my current script sans the numeric month. The filed in question is HRDTNR , "DATE NEXT REVIEW "

<?php

// DataTables PHP library
require( $_SERVER['DOCUMENT_ROOT']."/DataTables_Editor/php/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
//Editor::inst( $db, 'NWFF.PAYEMPDE','EMP' )
//Editor::inst( $db, 'BOBBRI.INVENTOR','INITEM' )
Editor::inst( $db, 'NWFF.PAYEHRLY', 'HREMPN')
->debug(true)
    ->fields(
     // Field::inst( 'name' )->validator( 'Validate::notEmpty' ),
        Field::inst('HREMPN') -> set(false),    // Used to disable editing to key field
        Field::inst('HRLOC'),                   // LOCATION I.D.
        Field::inst('HRFNAM'),                  // EMP FIRST NAME & INITIAL
        Field::inst('HRLNAM'),                  // EMPLOYEE LAST NAME
        Field::inst('HRDEPT') ,                  // DEPARTMENT
        Field::inst('HRYRSL'),                  // YEARLY SALARY

  Field::inst( 'HRDTNR' )  // DATE NEXT REVIEW
        ->validator( 'Validate::dateFormat', array(
            'format' => 'Ymd'
        ) )
          ->getFormatter( 'Format::datetime', array(
              'from' => 'Ymd',
              'to' =>   'F'
          ) )
    )
    ->process( $_POST )
    ->json();

Viewing all articles
Browse latest Browse all 82031

Trending Articles



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