v5:reference:connection:year
year
Description
The method year()
is a helper routine that simplifies the creation of an oft-used SQL statement to obtain just the year of a specified date/time field as a 4 digit number (YYYY).
Parameters
$fieldName
The date/time fieldname to be processed
Usage
/* * To return an employee_no and the year of a date field, * and sort by the hire date */ $sql = "SELECT emp_no, {$db->year('hire_date')} FROM employees ORDER BY {$db->year('hire_date')}"; $data = $db->getAssoc($sql);
v5/reference/connection/year.txt · Last modified: 2016/04/10 23:56 by mnewnham