Showing posts from June, 2013

php date format

format characterDescriptionExample returned valuesDay------dDay of the month, 2 digits with leading zeros01 to 31DA textual representation of a day, three lettersMon through SunjDay of the month without leading zeros1 to 31l (lowercase 'L')A full textual representation of the day of the weekSunday through SaturdayNISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)1 (for Monday) through 7 (for Sunday)SEnglish ordinal suffix for the day of the month, 2 charactersst, nd, rd or th. Works well with jwNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)zThe day of the year (starting from 0)0 through 365Week------WISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)Example: 42 (the 42nd week in the year)Month------FA full textual representation of a month, such as January or MarchJanuary through DecembermNumeric representation of a month, with leading zeros01 through 12MA short tex…

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(){ something here… } </script>

Reference: Model rules validation Yii

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


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')));