====== year ====== ~~NOTOC~~ **From Version 5.21.0-beta-2** == See Also == [[v5:reference:connection:day|day()]]\\ [[v5:reference:connection:month|month()]]\\ == Syntax == string year( string $fieldName, ) ===== 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);