Posts

Showing posts from June, 2013

php date format

format character Description Example returned values Day --- --- d Day of the month, 2 digits with leading zeros 01 to 31 D A textual representation of a day, three letters Mon through Sun j Day of the month without leading zeros 1 to 31 l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday N ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0) 1 (for Monday) through 7 (for Sunday) S English ordinal suffix for the day of the month, 2 characters st , nd , rd or th . Works well with j

jQuery multiple events like keyup, keypress, blur, change, focusout, etc call in one line

You can use .on() to bind a function to multiple events: $('#element').on('keyup keypress blur change', function() { ... });

yii menu with onclick link

yii menu : array('label'=>'Create Invoice', 'url'=>'', 'linkOptions'=>array('onclick'=>'{printInvoice();}', 'style'=>'cursor: pointer; text-decoration: none;',)), the html result : <a href="#" onclick="{printInvoice();}">Create Invoice</a> then create the js function : <script> function printInvoice(){ ..do something here… } </script>

Reference: Model rules validation Yii

http://www.yiiframework.com/wiki/56/#hh15

get first and last date in a month with php, mysql

mySql: SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 0 MONTH), '%Y-%m-01'); SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 0 MONTH)); php : $first = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y'))); $last = date('Y-m-t', mktime(0, 0, 0, date('m'), 1, date('Y')));