Get the last day of the month

calendar.monthrange provides this information: calendar.monthrange(year, month)     Returns weekday of first day of the month and number of days in month, for the specified year and month. >>> import calendar >>> calendar.monthrange(2002, 1) (1, 31) >>> calendar.monthrange(2008, 2) # leap years are handled correctly (4, 29) >>> calendar.monthrange(2100, 2) # years divisible by 100 but not … Read more

php weeks between 2 dates

Here’s an alternative solution using DateTime:- function datediffInWeeks($date1, $date2) { if($date1 > $date2) return datediffInWeeks($date2, $date1); $first = DateTime::createFromFormat(‘m/d/Y’, $date1); $second = DateTime::createFromFormat(‘m/d/Y’, $date2); return floor($first->diff($second)->days/7); } var_dump(datediffInWeeks(‘1/2/2013’, ‘6/4/2013’));// 21 See it working

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)